@tschk/moonshine-next 0.3.5 → 0.3.7

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": "@tschk/moonshine-next",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "Next.js API surface reimplemented on moonshine — drop Next, keep the imports",
5
5
  "license": "ISC",
6
6
  "type": "module",
@@ -21,9 +21,9 @@
21
21
  "./shaders": "./src/shaders.ts"
22
22
  },
23
23
  "dependencies": {
24
- "@tschk/moonshine": "^0.3.5",
25
- "@tschk/moonshine-router": "^0.3.5",
26
- "@tschk/moonshine-shaders": "^0.3.5"
24
+ "@tschk/moonshine": "^0.3.6",
25
+ "@tschk/moonshine-router": "^0.3.6",
26
+ "@tschk/moonshine-shaders": "^0.3.6"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": ">=18",
package/src/navigation.ts CHANGED
@@ -33,13 +33,13 @@ export function splitLocation(location: string): [string, string] {
33
33
  }
34
34
 
35
35
  /**
36
- * The moonshine router stores only the pathname, so a query string survives
37
- * navigation on `window.location` but not in the location signal. Prefer the
38
- * signal when it carries one (SSR / controlled paths) and fall back to the
39
- * browser's own search.
36
+ * The location signal carries the query, so the signal is the source of truth
37
+ * and a query-only navigation re-renders. The browser fallback remains for the
38
+ * one case the signal cannot cover: a controlled `path` prop given without a
39
+ * query while the address bar has one.
40
40
  */
41
41
  function readSearch(location: string): string {
42
- const fromSignal = splitLocation(location)[1];
42
+ const [, fromSignal] = splitLocation(location);
43
43
  if (fromSignal) return fromSignal;
44
44
  if (typeof window === "undefined") return "";
45
45
  return window.location.search.replace(/^\?/, "");