Open History to see the last commit
1import { For, createEffect } from 'solid-js'
2import { Link, useParams, useSearch } from '@tanstack/solid-router'
3β
4const probes = Array.from({ length: 10 }, (_, index) => index)
5β
6function runSelectorWork(input: string, salt: number) {
7 let value = salt
8β
9 for (let index = 0; index < input.length; index++) {
10 value = (value * 33 + input.charCodeAt(index) + index) >>> 0
11 }
12β
13 for (let index = 0; index < 16; index++) {
14 value = (value ^ (value << 13)) >>> 0
15 value = (value ^ (value >> 17)) >>> 0
16 value = (value ^ (value << 5)) >>> 0
17 }
18β
19 return value
20}
21β
22function ParamsProbe(props: { salt: number }) {
23 const params = useParams({
24 strict: false,
25 select: (nextParams) =>
26 runSelectorWork(
27 `${nextParams.a ?? ''}/${nextParams.b ?? ''}/${nextParams.c ?? ''}/${nextParams.d ?? ''}`,
28 props.salt,
29 ),
30 })
31β
32 createEffect(() => {
33 void params()
34 })
35β
36 return null
37}
38β
39function SearchProbe(props: { salt: number }) {
40 const search = useSearch({
41 strict: false,
42 select: (nextSearch) =>
43 runSelectorWork(String(nextSearch.q ?? ''), props.salt),
44 })
45β
46 createEffect(() => {
47 void search()
48 })
49β
50 return null
51}
52β
53function LinkProbe(props: { salt: number }) {
54 const value = String((props.salt % 97) + 1)
55β
56 return (
57 <Link
58 to="/$a/$b/$c/$d"
59 params={{
60 a: `a-${value}`,
61 b: `b-${value}`,
62 c: `c-${value}`,
63 d: `d-${value}`,
64 }}
65 search={{ q: `q-${value}` }}
66 preload={false}
67 >
68 Link
69 </Link>
70 )
71}
72β
73export function RouteWorkload() {
74 return (
75 <>
76 <For each={probes}>{(probe) => <ParamsProbe salt={probe + 1} />}</For>
77 <For each={probes}>{(probe) => <SearchProbe salt={probe + 11} />}</For>
78 <For each={probes}>{(probe) => <LinkProbe salt={probe + 21} />}</For>
79 </>
80 )
81}