MCPcopy Create free account
hub / github.com/Botloader/botloader / MaybePluginProvider

Function MaybePluginProvider

frontend/src/components/PluginProvider.tsx:9–24  ·  view source on GitHub ↗
({ pluginId, children }: { pluginId?: number, children: React.ReactNode })

Source from the content-addressed store, hash-verified

7
8
9export function MaybePluginProvider({ pluginId, children }: { pluginId?: number, children: React.ReactNode }) {
10 const session = useSession();
11
12 const fetchPlugin = useCallback(async () => {
13 if (!pluginId) {
14 throw new Error("No plugin id")
15 }
16
17 let scripts = await session.apiClient.getPlugin(pluginId!);
18 return scripts;
19 }, [pluginId, session])
20
21 return <FetchData loader={fetchPlugin} context={pluginContext}>
22 {children}
23 </FetchData>
24}

Callers

nothing calls this directly

Calls 2

useSessionFunction · 0.90
getPluginMethod · 0.80

Tested by

no test coverage detected