Comment

Comment by depressedpanda

No, I think you misunderstand how it works. The problem is that task 4, as you call it, runs after the navigation triggered by the redirect value.

The the author expects the side-effect -- navigation to a new page -- of the window.location.href setter to abort the code running below it. This obviously won't happen because there is no return in the first if-statement.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton