Skip to content

Race condition in resource() #59842

Closed
Closed

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.

Activity

  1. added
    area: coreIssues related to the framework runtime
    core: reactivityWork related to fine-grained reactivity in the core framework
    on Feb 3, 2025
  2. modified the milestone: needsTriage on Feb 3, 2025
  3. added a commit that references this issue on Feb 5, 2025
    b592b1b
  4. added a commit that references this issue on Feb 7, 2025
    4f92e3c
  5. angular-automatic-lock-bot commented on Mar 8, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  6. locked and limited conversation to collaborators on Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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