#Server-side seed in root beforeLoad?

11 messages · Page 1 of 1 (latest)

icy herald
#

create a server function and randomly choose in it

#

the issue is isomorphism. if you run on the server there is no isomorphism

#

again, if not choosing on the server, then generate the seed on the server so that the client has the same seed from then on

#

not necessarily, if you're caching the seed with, say, tanstack query, then you only need a single network request on first load

#

from then on, they share the same initial random seed

#

meaning that each time you generate a new random on the server and the client, at the same time, they will be the same

#

you HAVE to have at least one network request anyway

#

and that's not a tanstack start specific problem

#

in any case, i think just choosing on the server and sending that choice to the client is just the best and simplest way to do it

#

the seeding idea was just that, an idea

#

btw Math.random default seed is a unix time code