In SvelteKit 1.x goto
had a state option where it was possible to pass state when navigating
goto('/route', {state: {foo: 'bar'}})
On the route the value was available via
const foo = window.history.state.foo
With SvelteKit 2.0 state
is no longer documented on the goto
options and there's now pushState
, but calling
pushState('/route', { foo: 'bar' });
will only change the url while staying on the same route.
How to achieve the previous behaviour?
Probably just a type bug, see this issue.
It is fixed and the docs are updated, but the change is not published to the NPM package as of now (should be in > 2.0.3
).