Skip to content

Memoized sum disagrees with its async inputs during overlapping updates #3443

Description

@GabbeV

Describe the bug

Two async memos feed a synchronous sum memo. Updating their inputs 500ms apart makes A display 1 while B and Sum both display 0.

Replacing the sum memo with a plain getter removes the mismatch.

Your Example Website or App

https://s.olid.uk/id/WXOvPfyQQ6qoLawfAJMMSw

Steps to Reproduce the Bug or Issue

  1. Wait for initialization.
  2. Click Run.
  3. After one second, A becomes 1 while B and Sum remain 0.
  4. After another 500ms, B becomes 1 and Sum becomes 2.

Expected behavior

Sum should equal the displayed A + B throughout the update.

Screenshots or Videos

No response

Platform

Verified with compiled JSX in jsdom on Node.js 24.18.0, in development and production builds.

Additional context

Reproduced on next at c452850, #3439 at c2c9789 and #3337 at 20f3143.

Both updates use ordinary signals. No isPending reads, conditional dependencies or observer changes are involved.

Writing both inputs in the same event, without the await between them, removes the mismatch.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions