Skip to content

Same-value branch switch leaves a synchronous memo inconsistent with its inputs #3469

Description

@GabbeV

Describe the bug

While B is held at 0, updating A to 2 leaves Selected showing 1.

Selected is b() ? b() : a(), so with the displayed inputs A=2 and B=0, it should select A.

Your Example Website or App

https://s.olid.uk/id/qbPG6OYNRoG2FZgYcpia-Q

Steps to Reproduce the Bug or Issue

  1. Wait for initialization.
  2. Click Run.
  3. After half a second, A shows 2, B shows 0, and Selected still shows 1.

Expected behavior

Selected should remain consistent with the published inputs. Either A should remain held, or Selected should update alongside it.

Screenshots or Videos

No response

Platform

  • OS: Windows
  • Browser: Firefox

Additional context

Related to #3461, fixed by #3464. This version uses a synchronous memo, and switching branches initially produces the same value (1). A subsequent update to the previously selected source exposes the inconsistency.

Reproduces on next at 347a5ca.

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