Skip to content

Race condition in resource() #59842

@alxhub

Description

@alxhub

resource() has a race condition where a request change during the loader phase that happens at the right time will be dropped, causing the resource to display stale data. This seems to happen if:

  1. While the resource is loading, the request changes
  2. Before the effect() can run, the Promise for the previous load resolves, which sets the resource out of loading state.
  3. The effect runs for the new request, but the resource is no longer a valid loading state per this check.

The condition in (3) is really trying to guard that the resource hasn't been set into Local state after the request changed. The check here is probably unnecessarily strict, but also, we should have a more robust way of detecting this condition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimebugcore: reactivityWork related to fine-grained reactivity in the core framework

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions