@jsenv/navi 0.29.354 → 0.29.355
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/dev/jsenv_navi.js +74 -9
- package/dist/dev/jsenv_navi.js.map +4 -4
- package/dist/jsenv_navi.js +74 -9
- package/dist/jsenv_navi.js.map +4 -4
- package/docs/navigation.md +25 -0
- package/package.json +1 -1
package/docs/navigation.md
CHANGED
|
@@ -331,6 +331,31 @@ Where several redirecting routes answer for one url, the more specific wins —
|
|
|
331
331
|
router uses. Chains collapse into one navigation, and a cycle throws naming the
|
|
332
332
|
addresses it goes through.
|
|
333
333
|
|
|
334
|
+
#### A search param only the link carries: `dropSearchParams`
|
|
335
|
+
|
|
336
|
+
A share link can carry a param that is not for the app at all: `?v=k3f9x2`, a
|
|
337
|
+
fingerprint of what the link preview shows, there because WhatsApp caches one
|
|
338
|
+
preview per address. Once the link is opened it has done its job, and left in
|
|
339
|
+
the bar it gets copied and shared again, stale. The route that owns the address
|
|
340
|
+
declares it:
|
|
341
|
+
|
|
342
|
+
```js
|
|
343
|
+
export const GAME_ROUTE = route(`/games/:gameId=${gameIdSignal}`, {
|
|
344
|
+
searchParams: { weather: weatherSignal },
|
|
345
|
+
dropSearchParams: ["v"],
|
|
346
|
+
});
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
`/games/W-ABC234PQ?weather&v=k3f9x2` becomes `/games/W-ABC234PQ?weather` at the
|
|
350
|
+
door, exactly like a redirection: no history entry, no route action, no signal
|
|
351
|
+
written. The other params stay as they were written. Like a redirection, it
|
|
352
|
+
applies to the route's own address only.
|
|
353
|
+
|
|
354
|
+
A redirecting route on `/games/:gameId` cannot do this. A search param never
|
|
355
|
+
makes a pattern fail to match, so that route also matches the address without
|
|
356
|
+
`v`. It then redirects the address to itself, which does nothing, and it
|
|
357
|
+
reports `matching` next to `GAME_ROUTE` on every game page.
|
|
358
|
+
|
|
334
359
|
#### When the destination depends on data
|
|
335
360
|
|
|
336
361
|
`/admin` sends the reader to the first section their permissions allow: the
|