`UNSTABLE_MEMO_OUTPUT` fires on the memo `merge()` creates for a function source (`<C {...cond() ? { a } : {}} />`); its advice (`equals`) cannot be applied to that memo
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 56/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, typescript
- 領域
- frontend, performance
調査の方向性
Start with the function-source handling in packages/signals/src/store/utils.ts near line 994, then trace how MergeView reads the memo and how checkUnstableOutput reports it in packages/signals/src/core/attribution.ts. Reproduce with the supplied conditional spread and compare the suggested equality behavior with the listed controls. Done means the diagnostic is suppressed or actionable for this internal memo, with the supplied repro and controls behaving as described.
索引モデルが issue の本文から書いたものです。
説明
Versions: solid-js / @solidjs/web / @solidjs/signals / @solidjs/diagnostics 2.0.0-rc.18 (compiler: @solidjs/compiler 2.0.0-rc.18). Reproduces in dev with attribution enabled.
What happens
A component spread whose expression is not a plain object compiles to mergeProps(fn):
// <Child {...(on() ? { tone: 'info' } : {})} />
_$createComponent(Child, _$mergeProps(() => { return on() ? { tone: "info" } : {}; }));
merge() wraps every function source in a bare memo (packages/signals/src/store/utils.ts:994,
flattened[n] = createMemo(s as () => any)), so the memo is created with no options and gets Object.is equality.
The idiom (conditional spread, {...props.rest ?? {}}, {...pick(x)}) returns a fresh object on every run, so
once the source changes four times the attribution engine reports:
[UNSTABLE_MEMO_OUTPUT] memo "computed" produced a new-but-equivalent object on 4 consecutive runs — its equality gate never closes,
so every subscriber re-runs on every upstream change. Return stable references or pass an `equals` option.
(packages/signals/src/core/attribution.ts:1776-1815, message at 1797-1800.)
The user did not write that memo and cannot reach its options; the name is the anonymous "computed". The only
non-obvious way out is to hoist the expression into an own createMemo(..., { equals }) and spread that, which neither
the message nor the diagnostics page (documentation/solid-2.0/08-dev-diagnostics.md, UNSTABLE_MEMO_OUTPUT) says.
Subscribers are real: every props.x read through the merge view subscribes to this memo (utils.ts MergeView SOURCE_MEMO read), so a
new-but-equal object re-runs every prop reader, though no key changed.
Minimal repro
Standalone project: bun add [email protected] @solidjs/[email protected] @solidjs/[email protected] @solidjs/vite-plugin vitest jsdom @testing-library/jest-dom
with the solid vite plugin and environment: 'jsdom'.
import { captureArtifact } from '@solidjs/diagnostics'
import { createSignal, flush } from 'solid-js'
import { render } from '@solidjs/web'
function Child(props: { tone?: string }) { return <p>{props.tone}</p> }
const [n, setN] = createSignal(0)
const { artifact } = await captureArtifact(() => {
render(() => <Child {...(n() >= 0 ? { tone: 'info' } : {})} />, document.createElement('div'))
flush()
for (let i = 1; i <= 8; i++) { setN(i); flush() }
}, { scenario: 'unstable-spread' })
console.log(artifact.diagnostics.filter((d) => d.code === 'UNSTABLE_MEMO_OUTPUT').map((d) => d.message))
// -> one UNSTABLE_MEMO_OUTPUT for memo "computed"
Controls (same harness): <p {...(n() >= 0 ? { title: 'info' } : {})} /> (element spread, no merge memo) is silent;
const props = createMemo(() => ..., { equals: shallow }); <Child {...props()} /> is silent.
Expected
Either no diagnostic for a memo the user cannot configure, or a way to satisfy it.
Suggested fix (any of)
- Give the
merge()function-source memo a shallowequalsfor plain objects. A source is only ever consumed as a key bag (MergeViewreads keys and values), so two bags with identical own keys andObject.is-equal values are indistinguishable to readers. Verified locally by changing the single line to
createMemo(s, { equals: shallowPlainEqual }): the repro goes silent, the own-memo control stays silent. (Caveat: compare onlyObject.getPrototypeOf(x) === Object.prototype; leave stores/proxies/class instances on Object.is.) - Skip
checkUnstableOutputfor memos created bymerge()(flag them internal;_internalexists in dev) and give them a name such asmergeProps. - At minimum, make the message actionable for this case ("if this memo comes from a spread, hoist the expression into
createMemo(..., { equals })") and mention it on the diagnostics page.
No duplicate found (gh issue list -R solidjs/solid --search for UNSTABLE_MEMO_OUTPUT, "new-but-equivalent", "merge function source memo equals", "conditional spread props memo"): nothing relevant. Related only: #3325 (spread reads merge proxy through sources, merged).
Verified: the suggested option 1 applied to the installed dev build locally makes all three tests pass; the original was restored afterwards.
- 主要言語
- TypeScript
- スター
- 36.2k
- フォーク
- 1.1k
- 平均マージ
- 11時間 19分
- マージ済み PR(30日)
- 337
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
solidjs/solid のほかの issue
-
`lazy()`: remounting an already-loaded component renders empty (or the Suspense fallback) since 1.9.14対応中かも @itisrmk が 8 日前に担当しました。 オープン1.x
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
2.0.0-rc.18 | `await refresh(memo)` hangs in an action after an optimistic write and a dependency change対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 57/100
メンテナーはふだん 1 日以内に返信
-
[2.0] IMMUTABLE_UPDATE_IN_STORE false positive when an in-place `splice` shifts the next item into the removed index対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
`createRoot`'s dispose function keeps `fn` alive, so `<For>`/`<Index>` rows retain removed list items対応中かも @boombang が 10 日前に担当しました。 オープン1.x
難易度 4/5 1〜2日 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
a10y a10y-audit ai-driven-qa claude
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
linagora/twake-directory-manager#219 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
0️⃣ phase/new
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Pulse v7: buildPreferencesFromTelos() bypasses telosSectionOrFile(), renders empty on unified-TELOS installs対応中かも @zephyr91 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
danielmiessler/LifeOS#2393 ·
メンテナーはふだん 4 日以内に返信