UNPKG

@mui/internal-docs-infra

Version:

MUI Infra - internal documentation creation tools.

22 lines 1.07 kB
/** * On first render, kick off the heavy `useCode` chunks a block is about to need, * so they are already in flight before the content subtree mounts and * `useCode`/`useTransformManagement` awaits them. Mirrors * {@link useSpeculativeCodePreload} / {@link useSpeculativeEditingPreload}: the * detection is cheap and synchronous, the loaders run in a mount effect (so they * never block first paint), and each fetch is deduped page-wide with the eventual * consumer (the speculative preload and the consumer resolve the same promise). * * Where `CodeContent` is itself lazily loaded, this effect fires on the same * commit as the content `import()`, so the chunks download concurrently rather * than waterfalling (content → discover need → fetch). * * Signals are deliberately accurate so a block that needs nothing prefetches * nothing: a block with no transforms never pulls the transform engine (the * `jsondiffpatch` applier). */ export declare function useSpeculativeUseCodePreload({ hasTransforms }: { hasTransforms: boolean; }): void;