Open Proziam opened 1 year ago
Just curious, does calling await tick()
(imported from svelte)
before goto
solves your problem?
@Proziam FYI for our app, Kit version 1.22.6 the problem you describe occurs even when outside of a conditional block, and your workaround still cures it.
What is very odd is that we've been using SvKit since before 1.0 and have many, many uses of goto
. This feels like a regression of some sort.
@themajashurka For us, the tick
based workaround does not work. The problem persists.
@themajashurka When I was debugging this on our app tick didn't solve the issue.
@netaisllc I tested out most of the "solutions" I found when I was trying to debug this and the one I posted is the only one that worked on every test case I wrote. I haven't seen this issue outside of a conditional block yet though, so my app clearly isn't covering all the test cases.
I agree, this feels like a weird regression.
This issue still persists on the latest version of svelte/kit (2.5.5)
Symptoms unchanged, still doesn't throw an error of any sort.
Still fixing the issue with:
export const navigate = (url: string) => {
setTimeout(() => goto(url), 0);
}
I've never used Tauri before and have no idea how it works. It would be very helpful if you provide a minimal reproduction so that it's possible to diagnose the issue.
I've spent the last hour or so trying to make a repro without success. However, symptoms seem consistent with those described in this issue - https://github.com/sveltejs/svelte/issues/6732. FWIW, we've run into all of the same issues described in that thread, particularly with stores.
As for what Tauri is, it's running npm run build and then simply serving the website through the OS's native browser to make it function like a desktop app.
Also experiencing this issue. goto() has been used many times in my app so far and has worked fine up until just now. I've cleared every cache known to man, deleted .svelte-kit + node_modules and started fresh. Nothing fixes it except the janky setTimeout workaround.
Edit: Nginx was caching it. Shame on me.
Describe the bug
Using Tauri to build a desktop application I noticed that goto() doesn't work whenever it's called upon conditionally. If you put a console.log() above it, the console.log() does fire, and returns the expected value to indicate that goto() should also fire.
I found a workaround on reddit:
setTimeout(() => goto('/profile/name'), 0);
which does work.Reproduction
Apologies for the lack of proper reproduction. You can find other users describing the issue in this thread along with a code sample: https://www.reddit.com/r/sveltejs/comments/10o7tpu/sveltekit_issue_goto_not_working_on_ios/
WORKS
DOES NOT WORK
Logs
System Info
Severity
serious, but I can work around it
Additional Information
No response