Skip to content

Reading a visible optimistic value in Show holds an independent signal update #3698

Description

@GabbeV

Describe the bug

A synchronous signal write remains pending when a <Show> condition reads that signal alongside an already-visible optimistic value. The two writes occur in separate tasks:

const [optimistic, setOptimistic] = createOptimistic(false);
const [drag, setDrag] = createSignal(false);

const move = action(function* () {
  setOptimistic(true);
  yield new Promise<void>(() => {});
});

void move();
setTimeout(() => setDrag(true), 0);

<Show when={optimistic() && !drag()} keyed>
  <p>Optimistic content</p>
</Show>

After the timeout runs, optimistic() is visibly true, but drag() is still false, latest(drag) is true, and isPending(drag) is true. The independent signal update is held by the unfinished action even though the condition has a visible optimistic value to read.

Your Example Website or App

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

Steps to Reproduce the Bug or Issue

  1. Open the example and click Run reproduction once.
  2. Observe optimistic: true, drag: false, latest(drag): true, and isPending(drag): true.

Expected behavior

The separate synchronous signal write should publish immediately: drag() should be true, isPending(drag) should be false, and the optimistic content should disappear while the action remains open.

Platform

  • OS: Linux
  • Browser: Chromium 153.0.8010.12 (Playwright)
  • Solid: 2.0.0-rc.11 (next in the linked playground)

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