@jk2908/solas 0.3.4 → 0.3.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.5 - 2026-04-23
4
+
5
+ - Fixed client-side navigation to same-origin routes that later resolve to a 404 or error state by committing the target URL to browser history before the RSC payload finishes loading, so broken internal links no longer leave the route unchanged.
6
+
3
7
  ## 0.3.4 - 2026-04-23
4
8
 
5
9
  - Fixed `hydrateRoot` missing named export error in the browser by removing the erroneous `optimizeDeps.exclude` for `react-dom/client`. Excluding it prevented Vite from pre-bundling the CommonJS wrapper, so the named export was never exposed to browser ESM consumers.
@@ -95,7 +95,8 @@ export function BrowserRouterProvider({ children, setPayload, isNavigating = fal
95
95
  id.current += 1;
96
96
  const navigationId = id.current;
97
97
  // fallback for abort/error paths
98
- let path = window.location.pathname + window.location.search;
98
+ const currentPath = window.location.pathname + window.location.search;
99
+ let path = currentPath;
99
100
  const replace = opts?.replace ?? DEFAULT_GO_CONFIG.replace;
100
101
  controller.current?.abort();
101
102
  controller.current = null;
@@ -113,6 +114,16 @@ export function BrowserRouterProvider({ children, setPayload, isNavigating = fal
113
114
  throw new Error('Invalid navigation url');
114
115
  // switch to the normalised target once the url is valid
115
116
  path = key;
117
+ // internal client navigation should update the route immediately, even
118
+ // if the subsequent fetch resolves to a 404 or other error state
119
+ if (path !== currentPath) {
120
+ if (replace) {
121
+ window.history.replaceState(null, '', path);
122
+ }
123
+ else {
124
+ window.history.pushState(null, '', path);
125
+ }
126
+ }
116
127
  // if the target was already prefetched, use the cached response promise
117
128
  // and set existing to true so we don't remove it from cache
118
129
  // after navigation
@@ -143,15 +154,12 @@ export function BrowserRouterProvider({ children, setPayload, isNavigating = fal
143
154
  // the response
144
155
  if (navigationId !== id.current)
145
156
  return resolvedPath;
157
+ if (resolvedPath !== path) {
158
+ window.history.replaceState(null, '', resolvedPath);
159
+ }
146
160
  // this state update is already wrapped in a
147
161
  // transition before being passed as props
148
162
  setPayload?.(payload);
149
- if (replace) {
150
- window.history.replaceState(null, '', resolvedPath);
151
- }
152
- else {
153
- window.history.pushState(null, '', resolvedPath);
154
- }
155
163
  window.dispatchEvent(new CustomEvent(Solas.Events.names.NAVIGATION, {
156
164
  detail: { path: resolvedPath },
157
165
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jk2908/solas",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "A React Server Components meta-framework powered by Vite",
5
5
  "keywords": [
6
6
  "framework",