@copilotkitnext/react 0.0.29 → 0.0.30

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.
package/dist/index.js CHANGED
@@ -1484,22 +1484,28 @@ var CopilotKitCoreReact = class extends import_core.CopilotKitCore {
1484
1484
  var React4 = __toESM(require("react"));
1485
1485
  var import_react5 = require("@lit-labs/react");
1486
1486
  var import_jsx_runtime7 = require("react/jsx-runtime");
1487
- var CopilotKitInspectorBase = React4.lazy(() => {
1488
- if (typeof window === "undefined") {
1489
- const NullComponent = () => null;
1490
- return Promise.resolve({ default: NullComponent });
1491
- }
1492
- return import("@copilotkitnext/web-inspector").then((mod) => {
1493
- mod.defineWebInspector?.();
1494
- const Component = (0, import_react5.createComponent)({
1495
- tagName: mod.WEB_INSPECTOR_TAG,
1496
- elementClass: mod.WebInspectorElement,
1497
- react: React4
1487
+ var CopilotKitInspector = ({ core, ...rest }) => {
1488
+ const [InspectorComponent, setInspectorComponent] = React4.useState(null);
1489
+ React4.useEffect(() => {
1490
+ let mounted = true;
1491
+ import("@copilotkitnext/web-inspector").then((mod) => {
1492
+ mod.defineWebInspector?.();
1493
+ const Component = (0, import_react5.createComponent)({
1494
+ tagName: mod.WEB_INSPECTOR_TAG,
1495
+ elementClass: mod.WebInspectorElement,
1496
+ react: React4
1497
+ });
1498
+ if (mounted) {
1499
+ setInspectorComponent(() => Component);
1500
+ }
1498
1501
  });
1499
- return { default: Component };
1500
- });
1501
- });
1502
- var CopilotKitInspector = ({ core, ...rest }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(React4.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CopilotKitInspectorBase, { ...rest, core: core ?? null }) });
1502
+ return () => {
1503
+ mounted = false;
1504
+ };
1505
+ }, []);
1506
+ if (!InspectorComponent) return null;
1507
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(InspectorComponent, { ...rest, core: core ?? null });
1508
+ };
1503
1509
  CopilotKitInspector.displayName = "CopilotKitInspector";
1504
1510
 
1505
1511
  // src/providers/CopilotKitProvider.tsx