Skip to content

Find a prettier fix for loading pages before getting actor #110

Closed
@joepio

Description

@joepio

I'm working on authentication #108 and noticed an annoyance. When I refresh the page, the first request will be sent as PublicAgent (no agent), and will therefore return a 401 if the resource requires signing in. However, the user will be signed in automatically a fraction later. This would result in the user being signed in, yet staring at an unauthorized page. He could press the retry button, of course, but that's suboptimal...

So I added some logic in the useResource hook, which keeps track of the current agent. If the agent changes, re-try fetching the resource. It works pretty well, but it adds quite a bit of logic, and possibly makes performance worse.

I'd like to find a better solution to this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions