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

Function QuickAddBridge

packages/react/src/pages/integration-browse.tsx:335–350  ·  view source on GitHub ↗

Collects each plugin's bound quick-add callback into the page's map. * A component per plugin, not a hook over a list: `useQuickAdd` is a hook, * and mounting one bridge per plugin is how a fixed set of per-plugin hooks * stays rules-of-hooks clean.

(props: {
  readonly pluginKey: string;
  /** The plugin's hook, called UNCONDITIONALLY — the host renders a bridge
   *  only for plugins that have one, so this component's hook sequence never
   *  depends on a plugin object's shape. */
  readonly useQuickAdd: () => QuickAddFn;
  readonly register: (key: string, fn: QuickAddFn | null) => void;
})

Source from the content-addressed store, hash-verified

333 * and mounting one bridge per plugin is how a fixed set of per-plugin hooks
334 * stays rules-of-hooks clean. */
335function QuickAddBridge(props: {
336 readonly pluginKey: string;
337 /** The plugin's hook, called UNCONDITIONALLY — the host renders a bridge
338 * only for plugins that have one, so this component's hook sequence never
339 * depends on a plugin object's shape. */
340 readonly useQuickAdd: () => QuickAddFn;
341 readonly register: (key: string, fn: QuickAddFn | null) => void;
342}) {
343 const { pluginKey, useQuickAdd, register } = props;
344 const fn = useQuickAdd();
345 useEffect(() => {
346 register(pluginKey, fn);
347 return () => register(pluginKey, null);
348 }, [pluginKey, fn, register]);
349 return null;
350}
351
352/** One bridge per plugin KEY: a duplicate key would share the React key and
353 * the callback slot, letting either copy's cleanup delete the other. */

Callers

nothing calls this directly

Calls 1

registerFunction · 0.85

Tested by

no test coverage detected