Skip to content

[2.0 / next] A visible button's condition throws in its click handler during a held update #4109

Open

Description

@GabbeV

Describe the bug

A button is shown with <Show when={condition()}>, and its click handler reads the same condition() memo.

An update makes that memo throw while a rendered async sibling holds the frame. The button stays visible, but clicking it again throws the new error. The ordinary outside read sees the failure before the frame that still shows the button reveals.

Your Example Website or App

https://s.olid.uk/id/180Kc1jFSmCmMLNpDCL08Q

Steps to Reproduce the Bug or Issue

  1. Click Use value. It logs condition: true and starts a five-second update.
  2. While Update pending… click Use value again. is visible, click Use value again.
  3. The click handler throws Condition failed, even though the button is still visible and the async sibling still shows initial.
  4. When the async sibling resolves, it becomes updated and the error boundary replaces the button with the error.

Both clicks are manual. Reload the playground to repeat.

Expected behavior

While the held frame still shows the button, the ordinary condition() read in its event handler should retain the committed true result. The failure should become observable when the frame reveals and the error boundary replaces the button.

Screenshots or Videos

No response

Platform

Additional context

Follow-up to #4085. The hosted repro verifies that the second click throws while the button and pending indicator remain visible. The boundary only replaces the button after the async sibling resolves.

D-41 specifies that ordinary outside reads retain the committed outcome during a hold. It already records an early-read deviation for derived stores; this example uses a synchronous scalar memo.

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