@tangle-network/agent-app 0.50.15 → 0.50.17

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.
@@ -8,7 +8,7 @@ import "../chunk-FBVLEGEG.js";
8
8
  import "../chunk-ENLRJYVW.js";
9
9
  import {
10
10
  ChatComposer
11
- } from "../chunk-CPL7LLO5.js";
11
+ } from "../chunk-OUK7JZDV.js";
12
12
  import "../chunk-L7MB2LLM.js";
13
13
  import {
14
14
  ModelPicker
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ComposerModeControls,
3
3
  EntryComposer
4
- } from "../chunk-CPL7LLO5.js";
4
+ } from "../chunk-OUK7JZDV.js";
5
5
  import "../chunk-L7MB2LLM.js";
6
6
  import "../chunk-5BDSNHWW.js";
7
7
  import "../chunk-SJWIZT7B.js";
@@ -274,12 +274,18 @@ var LazyLoadBoundary = class extends Component {
274
274
  };
275
275
  var ROUTE_RELOAD_KEY = "agent-app:route-chunk-reload-at";
276
276
  var ROUTE_RELOAD_WINDOW_MS = 6e4;
277
+ var ROUTE_RELOAD_PARAM = "__agent_app_route_reload";
277
278
  var CHUNK_LOAD_FAILURE = /failed to fetch dynamically imported module|error loading dynamically imported module|importing a module script failed|loading chunk .* failed|failed to load module script/i;
278
279
  function isChunkLoadFailure(error) {
279
280
  if (typeof error !== "object" || error === null) return false;
280
281
  const candidate = error;
281
282
  return candidate.name === "ChunkLoadError" || typeof candidate.message === "string" && CHUNK_LOAD_FAILURE.test(candidate.message);
282
283
  }
284
+ function loadFreshDocument() {
285
+ const url = new URL(window.location.href);
286
+ url.searchParams.set(ROUTE_RELOAD_PARAM, Date.now().toString(36));
287
+ window.location.replace(url.toString());
288
+ }
283
289
  function RouteLoadFailure({ error, autoReloadOnChunkError }) {
284
290
  useEffect2(() => {
285
291
  if (!autoReloadOnChunkError || !isChunkLoadFailure(error) || typeof window === "undefined") return;
@@ -288,7 +294,7 @@ function RouteLoadFailure({ error, autoReloadOnChunkError }) {
288
294
  const elapsed = Date.now() - lastReload;
289
295
  if (lastReload > 0 && elapsed >= 0 && elapsed < ROUTE_RELOAD_WINDOW_MS) return;
290
296
  window.sessionStorage.setItem(ROUTE_RELOAD_KEY, String(Date.now()));
291
- window.location.reload();
297
+ loadFreshDocument();
292
298
  } catch {
293
299
  }
294
300
  }, [error, autoReloadOnChunkError]);
@@ -300,13 +306,19 @@ function RouteLoadFailure({ error, autoReloadOnChunkError }) {
300
306
  {
301
307
  type: "button",
302
308
  className: "mt-4 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
303
- onClick: () => window.location.reload(),
309
+ onClick: loadFreshDocument,
304
310
  children: "Reload page"
305
311
  }
306
312
  )
307
313
  ] });
308
314
  }
309
315
  function RouteChunkBoundary({ children, autoReloadOnChunkError = false }) {
316
+ useEffect2(() => {
317
+ const url = new URL(window.location.href);
318
+ if (!url.searchParams.has(ROUTE_RELOAD_PARAM)) return;
319
+ url.searchParams.delete(ROUTE_RELOAD_PARAM);
320
+ window.history.replaceState(window.history.state, "", url);
321
+ }, []);
310
322
  return /* @__PURE__ */ jsx(LazyLoadBoundary, { renderFailure: (error) => /* @__PURE__ */ jsx(RouteLoadFailure, { error, autoReloadOnChunkError }), children });
311
323
  }
312
324
 
@@ -1888,4 +1900,4 @@ export {
1888
1900
  ComposerModeControls,
1889
1901
  EntryComposer
1890
1902
  };
1891
- //# sourceMappingURL=chunk-CPL7LLO5.js.map
1903
+ //# sourceMappingURL=chunk-OUK7JZDV.js.map