MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / ExecutorPluginsProvider

Function ExecutorPluginsProvider

packages/core/sdk/src/client.ts:489–511  ·  view source on GitHub ↗
(
  props: ExecutorPluginsProviderProps,
)

Source from the content-addressed store, hash-verified

487}
488
489export function ExecutorPluginsProvider(
490 props: ExecutorPluginsProviderProps,
491): ReturnType<typeof createElement> {
492 const { plugins, children } = props;
493 const value = useMemo<ExecutorPluginsContextValue>(
494 () => ({
495 plugins,
496 integrationPlugins: plugins.flatMap((p) =>
497 p.integrationPlugin ? [p.integrationPlugin] : [],
498 ),
499 secretProviderPlugins: plugins.flatMap((p) =>
500 p.secretProviderPlugin ? [p.secretProviderPlugin] : [],
501 ),
502 }),
503 [plugins],
504 );
505 // Kick off lazy chunk downloads for every integration plugin once the host
506 // mounts, so navigating into an add/edit page doesn't suspend.
507 useEffect(() => {
508 for (const ip of value.integrationPlugins) ip.preload?.();
509 }, [value.integrationPlugins]);
510 return createElement(ExecutorPluginsContext.Provider, { value }, children);
511}
512
513const usePluginsCtx = (hookName: string): ExecutorPluginsContextValue => {
514 const ctx = useContext(ExecutorPluginsContext);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected