Skip to content

useRequireAuth redirects on all errors, not just unauthenticated #147

@btc

Description

@btc

`useRequireAuth` in `web/src/hooks/use-auth.ts` checks `isError` which is true for ANY query failure (500, network timeout, etc.), not just `Code.Unauthenticated`. A momentary server hiccup on any protected route redirects the user to `/login`.

Fix: Check for `ConnectError` with `Code.Unauthenticated` specifically (matching the `useOptionalAuth` pattern). Show an error state for other failures instead of redirecting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions