mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-26 19:07:17 +00:00
29 lines
870 B
TypeScript
29 lines
870 B
TypeScript
import React, { Suspense } from 'react';
|
|
import type { PluginHostDrawnPageProps } from './PluginHostDrawnPage';
|
|
|
|
const PluginHostDrawnPageImpl = React.lazy(() =>
|
|
import('./PluginHostDrawnPage').then((module) => ({ default: module.PluginHostDrawnPage })),
|
|
);
|
|
|
|
/**
|
|
* Lazy boundary for host-drawn plugin views so css-tree, mdn-data, and
|
|
* @remote-dom/core stay out of the startup entry bundle until a plugin view
|
|
* actually opens.
|
|
*/
|
|
export function LazyPluginHostDrawnPage(props: PluginHostDrawnPageProps) {
|
|
const slot = props.slot.split(':')[0];
|
|
return (
|
|
<Suspense
|
|
fallback={
|
|
props.active ? (
|
|
<p data-plugin-view-slot={slot} role="status" className="p-4 text-sm text-muted-foreground">
|
|
{props.loadingLabel}
|
|
</p>
|
|
) : null
|
|
}
|
|
>
|
|
<PluginHostDrawnPageImpl {...props} />
|
|
</Suspense>
|
|
);
|
|
}
|