rari 0.7.2 → 0.7.3

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/client.mjs CHANGED
@@ -889,8 +889,20 @@ function ClientRouter({ children, initialRoute }) {
889
889
  signal: abortController.signal
890
890
  });
891
891
  if (!response.ok) throw new Error(`Failed to fetch: ${response.status}`);
892
+ const finalPath = new URL(response.url).pathname;
893
+ const actualTargetPath = finalPath !== targetPath ? finalPath : targetPath;
894
+ if (finalPath !== targetPath) window.history.replaceState({
895
+ route: finalPath,
896
+ navigationId,
897
+ scrollPosition: {
898
+ x: window.scrollX,
899
+ y: window.scrollY
900
+ },
901
+ timestamp: Date.now(),
902
+ key: options.historyKey || generateHistoryKey()
903
+ }, "", finalPath);
892
904
  if (abortController.signal.aborted) {
893
- cleanupAbortedNavigation(targetPath, navigationId);
905
+ cleanupAbortedNavigation(actualTargetPath, navigationId);
894
906
  return;
895
907
  }
896
908
  try {
@@ -910,7 +922,7 @@ function ClientRouter({ children, initialRoute }) {
910
922
  if (done) break;
911
923
  if (abortController.signal.aborted) {
912
924
  await reader.cancel();
913
- cleanupAbortedNavigation(targetPath, navigationId);
925
+ cleanupAbortedNavigation(actualTargetPath, navigationId);
914
926
  return;
915
927
  }
916
928
  buffer += decoder.decode(value, { stream: true });
@@ -921,7 +933,7 @@ function ClientRouter({ children, initialRoute }) {
921
933
  if (buffer.trim()) window.dispatchEvent(new CustomEvent("rari:rsc-row", { detail: { rscRow: buffer } }));
922
934
  window.dispatchEvent(new CustomEvent("rari:navigate", { detail: {
923
935
  from: fromRoute,
924
- to: targetPath,
936
+ to: actualTargetPath,
925
937
  navigationId,
926
938
  options,
927
939
  routeInfo,
@@ -936,7 +948,7 @@ function ClientRouter({ children, initialRoute }) {
936
948
  const rscWireFormat = await response.text();
937
949
  window.dispatchEvent(new CustomEvent("rari:navigate", { detail: {
938
950
  from: fromRoute,
939
- to: targetPath,
951
+ to: actualTargetPath,
940
952
  navigationId,
941
953
  options,
942
954
  routeInfo,
@@ -945,19 +957,19 @@ function ClientRouter({ children, initialRoute }) {
945
957
  } }));
946
958
  }
947
959
  if (abortController.signal.aborted) {
948
- cleanupAbortedNavigation(targetPath, navigationId);
960
+ cleanupAbortedNavigation(actualTargetPath, navigationId);
949
961
  return;
950
962
  }
951
963
  if (isMountedRef.current) {
952
- currentRouteRef.current = targetPath;
964
+ currentRouteRef.current = actualTargetPath;
953
965
  setNavigationState((prev) => ({
954
966
  ...prev,
955
- currentRoute: targetPath,
967
+ currentRoute: actualTargetPath,
956
968
  error: null
957
969
  }));
958
- errorHandlerRef.current.resetRetry(targetPath);
970
+ errorHandlerRef.current.resetRetry(actualTargetPath);
959
971
  if (options.historyKey) requestAnimationFrame(() => {
960
- statePreserverRef.current.restoreState(targetPath);
972
+ statePreserverRef.current.restoreState(actualTargetPath);
961
973
  });
962
974
  }
963
975
  pendingNavigationsRef.current.delete(targetPath);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rari",
3
3
  "type": "module",
4
- "version": "0.7.2",
4
+ "version": "0.7.3",
5
5
  "description": "Runtime Accelerated Rendering Infrastructure (Rari)",
6
6
  "author": "Ryan Skinner",
7
7
  "license": "MIT",
@@ -93,16 +93,16 @@
93
93
  "picocolors": "^1.1.1"
94
94
  },
95
95
  "optionalDependencies": {
96
- "rari-darwin-arm64": "0.7.2",
97
- "rari-darwin-x64": "0.7.2",
98
- "rari-linux-arm64": "0.7.2",
99
- "rari-linux-x64": "0.7.2",
100
- "rari-win32-x64": "0.7.2"
96
+ "rari-darwin-arm64": "0.7.3",
97
+ "rari-darwin-x64": "0.7.3",
98
+ "rari-linux-arm64": "0.7.3",
99
+ "rari-linux-x64": "0.7.3",
100
+ "rari-win32-x64": "0.7.3"
101
101
  },
102
102
  "devDependencies": {
103
103
  "@types/node": "^25.0.8",
104
104
  "@types/react": "^19.2.8",
105
- "@typescript/native-preview": "^7.0.0-dev.20260113.1",
105
+ "@typescript/native-preview": "^7.0.0-dev.20260114.1",
106
106
  "chokidar": "^5.0.0",
107
107
  "eslint": "^9.39.2",
108
108
  "oxlint": "^1.39.0",
@@ -354,8 +354,26 @@ export function ClientRouter({ children, initialRoute }: ClientRouterProps) {
354
354
  if (!response.ok)
355
355
  throw new Error(`Failed to fetch: ${response.status}`)
356
356
 
357
+ const finalUrl = new URL(response.url)
358
+ const finalPath = finalUrl.pathname
359
+ const actualTargetPath = finalPath !== targetPath ? finalPath : targetPath
360
+
361
+ if (finalPath !== targetPath) {
362
+ window.history.replaceState(
363
+ {
364
+ route: finalPath,
365
+ navigationId,
366
+ scrollPosition: { x: window.scrollX, y: window.scrollY },
367
+ timestamp: Date.now(),
368
+ key: options.historyKey || generateHistoryKey(),
369
+ },
370
+ '',
371
+ finalPath,
372
+ )
373
+ }
374
+
357
375
  if (abortController.signal.aborted) {
358
- cleanupAbortedNavigation(targetPath, navigationId)
376
+ cleanupAbortedNavigation(actualTargetPath, navigationId)
359
377
  return
360
378
  }
361
379
 
@@ -386,7 +404,7 @@ export function ClientRouter({ children, initialRoute }: ClientRouterProps) {
386
404
 
387
405
  if (abortController.signal.aborted) {
388
406
  await reader.cancel()
389
- cleanupAbortedNavigation(targetPath, navigationId)
407
+ cleanupAbortedNavigation(actualTargetPath, navigationId)
390
408
  return
391
409
  }
392
410
 
@@ -413,7 +431,7 @@ export function ClientRouter({ children, initialRoute }: ClientRouterProps) {
413
431
  window.dispatchEvent(new CustomEvent('rari:navigate', {
414
432
  detail: {
415
433
  from: fromRoute,
416
- to: targetPath,
434
+ to: actualTargetPath,
417
435
  navigationId,
418
436
  options,
419
437
  routeInfo,
@@ -433,7 +451,7 @@ export function ClientRouter({ children, initialRoute }: ClientRouterProps) {
433
451
  window.dispatchEvent(new CustomEvent('rari:navigate', {
434
452
  detail: {
435
453
  from: fromRoute,
436
- to: targetPath,
454
+ to: actualTargetPath,
437
455
  navigationId,
438
456
  options,
439
457
  routeInfo,
@@ -444,24 +462,24 @@ export function ClientRouter({ children, initialRoute }: ClientRouterProps) {
444
462
  }
445
463
 
446
464
  if (abortController.signal.aborted) {
447
- cleanupAbortedNavigation(targetPath, navigationId)
465
+ cleanupAbortedNavigation(actualTargetPath, navigationId)
448
466
  return
449
467
  }
450
468
 
451
469
  if (isMountedRef.current) {
452
- currentRouteRef.current = targetPath
470
+ currentRouteRef.current = actualTargetPath
453
471
 
454
472
  setNavigationState(prev => ({
455
473
  ...prev,
456
- currentRoute: targetPath,
474
+ currentRoute: actualTargetPath,
457
475
  error: null,
458
476
  }))
459
477
 
460
- errorHandlerRef.current.resetRetry(targetPath)
478
+ errorHandlerRef.current.resetRetry(actualTargetPath)
461
479
 
462
480
  if (options.historyKey) {
463
481
  requestAnimationFrame(() => {
464
- statePreserverRef.current.restoreState(targetPath)
482
+ statePreserverRef.current.restoreState(actualTargetPath)
465
483
  })
466
484
  }
467
485
  }