8000 When using SSR errors are always thrown · Issue #229 · posva/pinia-colada · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
When using SSR errors are always thrown #229
Open
@GerryWilko

Description

@GerryWilko

I have identified an inconsistency when using SSR with Pinia Colada related to errored states.

The following line performs a refresh of any useQuery usage inside the onServerPrefetch block. This only gets executed on the server side but causes inconsistent behaviour in relation to errors as errors are thrown due to the refresh(true) being used.

onServerPrefetch(async () => {
if (toValue(enabled)) await refresh(true)
})

I'm not sure I fully understand why there is an explicit refresh call on SSR as if you set it to enabled it seems to evaluate the query anyway but setting throw on error makes it so that you cannot use a query that may error with SSR.

Not sure if this is a bug or a explicit design decision but it does restrict where Pinia Colada can be used as you cannot control this behavior from during SSR.

Should we consider removing this onServerPrefetch block entirely or at least change this line to refresh(false) to stop throwing the errors?

Metadata

Metadata

Assignees

No one assigned

    Labels

    ⚡️ enhancementimprovement over an existing feature

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0