@ethisyscore/plugin-ui 1.74.0 → 1.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1056,6 +1056,8 @@ interface DefinePlatformReactPluginOverlayOptions {
1056
1056
  styleId: string;
1057
1057
  css: string;
1058
1058
  manifest?: Record<string, Partial<Record<string, ViewComponent>>>;
1059
+ /** Override the per-overlay `QueryClient`. */
1060
+ queryClient?: QueryClient;
1059
1061
  wrapOverlay?: (overlay: ReactElement) => ReactElement;
1060
1062
  }
1061
1063
  /**
@@ -1056,6 +1056,8 @@ interface DefinePlatformReactPluginOverlayOptions {
1056
1056
  styleId: string;
1057
1057
  css: string;
1058
1058
  manifest?: Record<string, Partial<Record<string, ViewComponent>>>;
1059
+ /** Override the per-overlay `QueryClient`. */
1060
+ queryClient?: QueryClient;
1059
1061
  wrapOverlay?: (overlay: ReactElement) => ReactElement;
1060
1062
  }
1061
1063
  /**
@@ -565,22 +565,41 @@ function useOverlayHost() {
565
565
  }
566
566
  return api;
567
567
  }
568
+ function makeDefaultQueryClient2() {
569
+ return new QueryClient({
570
+ defaultOptions: {
571
+ queries: {
572
+ retry: 1,
573
+ refetchOnWindowFocus: false,
574
+ staleTime: 3e4
575
+ }
576
+ }
577
+ });
578
+ }
579
+ var defaultQueryClient2 = makeDefaultQueryClient2();
568
580
  function definePlatformReactPluginOverlay(Overlay, options) {
569
- const { rootClassName, styleId, css, manifest = {}, wrapOverlay } = options;
581
+ const { rootClassName, styleId, css, manifest = {}, queryClient = defaultQueryClient2, wrapOverlay } = options;
570
582
  return function MountedOverlay(props) {
571
583
  const tree = createElement(
572
584
  OverlayHostContext.Provider,
573
585
  { value: props.overlayHost },
586
+ // react-query provider — an overlay bundle has its own react-query module
587
+ // instance, so the host's app-wide client is invisible across the bundle
588
+ // boundary; it needs its own provider exactly as each page gets one.
574
589
  createElement(
575
- TemplateContext.Provider,
576
- { value: manifest },
577
- createElement(PluginStyleScope, { id: styleId, css }),
590
+ QueryClientProvider,
591
+ { client: queryClient },
578
592
  createElement(
579
- "div",
580
- { className: `${EHX_PLUGIN_ROOT_CLASS} ${rootClassName}` },
581
- // Overlay surfaces open their own dialogs and menus, so they need the same
582
- // portal containment as pages (see definePlatformReactPluginPage).
583
- createElement(PluginPortalScope, null, createElement(Overlay, props))
593
+ TemplateContext.Provider,
594
+ { value: manifest },
595
+ createElement(PluginStyleScope, { id: styleId, css }),
596
+ createElement(
597
+ "div",
598
+ { className: `${EHX_PLUGIN_ROOT_CLASS} ${rootClassName}` },
599
+ // Overlay surfaces open their own dialogs and menus, so they need the same
600
+ // portal containment as pages (see definePlatformReactPluginPage).
601
+ createElement(PluginPortalScope, null, createElement(Overlay, props))
602
+ )
584
603
  )
585
604
  )
586
605
  );