Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Optimistic store update is hidden after a local derived-store write inside an action

オープン
#3,796 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
javascript, typescript
領域
frontend

調査の方向性

The report provides a playground reproduction but names no source files or tests. Start by running the reproduction and tracing how createOptimisticStore handles the local derived-store write and the following optimistic write while the action is pending. Done means the view shows New / saving: true during the save and reconciles to the authoritative source after completion.

索引モデルが issue の本文から書いたものです。

説明

Describe the bug

On experimental build 6f77b1b, writing a client-only flag to a writable derived store inside an action prevents a subsequent optimistic store update from appearing while that action is pending.

The optimistic store wraps the derived store. The local write only sets failed = false; the optimistic write changes title to "New" and sets saving = true. A direct JSX binding keeps showing "Old" and saving: false until the action completes.

const [cards, setOptimistic] = createOptimisticStore(local);

const save = action(function* () {
  setLocal(draft => { draft[0].failed = false; });
  setOptimistic(draft => {
    draft[0].title = "New";
    draft[0].saving = true;
  });
  yield completion;
});

Removing the setLocal call makes the optimistic update appear. The reproduction uses a normal component and direct text binding, without For, Show, routing, or external data loading.

Your Example Website or App

https://s.olid.uk/id/d27cf7de-2cc1-45a8-9144-6868e307a78f

Steps to Reproduce the Bug or Issue
  1. Open the playground and click Run once.
  2. During the two-second simulated save, observe Old / saving: false instead of the optimistic values.
  3. After completion, the display changes to New / saving: false. The report records both states.
  4. Reload and remove the marked setLocal call to compare: the optimistic values appear during the save.
Expected behavior

The optimistic view should immediately show New / saving: true while the action is pending, including when the action first writes to its underlying local store. After completion, it should follow the authoritative source with the temporary saving flag removed.

Platform
Additional context

The identical reproduction with published RC.13 is here: https://s.olid.uk/id/cf602874-eee9-400c-bd96-3022a77b7291

With the local flag write RC.13 6f77b1b
During the pending action New / saving: true Old / saving: false
After completion Old / saving: false New / saving: false

RC.13 shows the optimistic update correctly but suppresses the later source reconciliation discussed in #3733. The newer build reconciles correctly after completion, but loses the optimistic display while pending. Both playgrounds have Tailwind disabled.

主要言語
TypeScript
スター
36.1k
フォーク
1.1k
平均マージ
10時間 7分
マージ済み PR(30日)
289

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

solidjs/solid のほかの issue

solidjs/solid の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。