@shellui/core 0.2.0-beta.1 → 0.2.0-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shellui/core",
3
- "version": "0.2.0-beta.1",
3
+ "version": "0.2.0-beta.2",
4
4
  "description": "ShellUI Core - Core React application runtime",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -58,7 +58,7 @@
58
58
  "workbox-strategies": "^7.1.0",
59
59
  "workbox-cacheable-response": "^7.1.0",
60
60
  "workbox-expiration": "^7.1.0",
61
- "@shellui/sdk": "0.2.0-beta.1"
61
+ "@shellui/sdk": "0.2.0-beta.2"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "react": "^18.0.0 || ^19.0.0",
@@ -8,7 +8,7 @@ import {
8
8
  type ShellUIUrlPayload,
9
9
  type ShellUIMessage,
10
10
  } from '@shellui/sdk';
11
- import { useEffect, useRef, useState } from 'react';
11
+ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
12
12
  import { useNavigate } from 'react-router';
13
13
  import { LOADING_OVERLAY_DURATION_MS } from '../constants/loading';
14
14
  import { LoadingOverlay } from './LoadingOverlay';
@@ -32,11 +32,6 @@ export const ContentView = ({
32
32
  const iframeRef = useRef<HTMLIFrameElement>(null);
33
33
  const cancelRevealRef = useRef<(() => void) | null>(null);
34
34
  const mountTimeRef = useRef(Date.now());
35
- /** Real history methods; stored once so we never restore our no-ops after a second effect run. */
36
- const historyOriginalsRef = useRef<{
37
- pushState: History['pushState'];
38
- replaceState: History['replaceState'];
39
- } | null>(null);
40
35
 
41
36
  const [isLoading, setIsLoading] = useState(() => {
42
37
  // Skip overlay when same app URL was just loaded (e.g. switching App ↔ Root with same url)
@@ -48,7 +43,7 @@ export const ContentView = ({
48
43
 
49
44
  const MIN_LOADING_MS = 80; // Don't reveal before this, reduces blink from theme/layout paint
50
45
 
51
- useEffect(() => {
46
+ useLayoutEffect(() => {
52
47
  if (!iframeRef.current) {
53
48
  return;
54
49
  }
@@ -56,17 +51,14 @@ export const ContentView = ({
56
51
  return () => {
57
52
  removeIframe(iframeId);
58
53
  };
59
- }, []);
54
+ }, [iframeUrl, navItem.path]);
60
55
 
61
- useEffect(() => {
56
+ useLayoutEffect(() => {
62
57
  if (ignoreMessages) return;
63
58
  if (isLoading) return;
64
59
  if (iframeRef.current) {
65
60
  setIsLoading(true);
66
- setIframeUrl('about:blank');
67
- setTimeout(() => {
68
- setIframeUrl(url);
69
- }, 60);
61
+ setIframeUrl(url);
70
62
  }
71
63
  }, [navItem]);
72
64
 
@@ -225,6 +217,7 @@ export const ContentView = ({
225
217
  <iframe
226
218
  ref={iframeRef}
227
219
  src={iframeUrl}
220
+ key={iframeUrl + navItem.path}
228
221
  loading="eager"
229
222
  style={{
230
223
  width: '100%',