`store.users.push(x)` in a handler compiles with no diagnostic, and the write is lost
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 62/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- javascript, typescript
- 領域
- compilers
研究方向
Start by running analyze on the program in the issue, which reports nothing, and by reading the lowered handler __rt.snapshot(v$store)?.users?.push(2). Find where the checker walks handler bodies and inspect member calls whose receiver is a source path, then check the list of mutating methods against decision 20 in 07. Done when analyze emits a diagnostic that points to the := form for push and the other listed methods, and the existing checker tests still pass.
由索引模型根據 Issue 內容生成。
描述
Calling a mutating method on a source's value in a handler, such as store.users.push(2), compiles with no diagnostic, and the write never happens. 07 decision 20 says "only := and guess mutate", so this should be a diagnostic that points to the := form, for example store.users := [...store.users, 2].
Program
export default component App() {
source store := { users: [1] }
<main>
<button onClick={() => { store.users.push(2) }}>add</button>
<p>{len(store.users)}</p>
</main>
}
analyze reports no diagnostics. The handler lowers to:
__rt.snapshot(v$store)?.users?.push(2);
That calls push on a read of the store, outside its setter. Solid ignores the write. In development it logs [STORE_WRITE_OUTSIDE_SETTER] Writing store property "1" outside its setter was ignored; that warning is development-only, so a production build drops the write without a word.
Frames
| instant | action | frame |
|---|---|---|
| 0 | mount | add1 |
| 1 | click add |
add1 (the list is unchanged) |
splice behaves the same way, and so presumably do the other mutating methods (pop, shift, unshift, sort, reverse, fill, copyWithin, and Map/Set writes). A program can also reach this through a plain function the handler calls with the source's value, which the checker may not be able to see. The direct call on a source path is the case it can see.
Version: main at e650b85.
- 主要語言
- TypeScript
- 星號
- 127
- 分支
- 7
- 平均合併
- 15 小時 42 分鐘
- 30 天內合併 PR
- 63
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
solidjs/reactivescript 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 84/100
solidjs/reactivescript#96 ·
維護者通常 1 天內回覆
-
Vite front end keeps serving a failed build after the missing/broken imported module is fixed可能已有人在做 @cgaaf 於 1 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 77/100
solidjs/reactivescript#84 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
solidjs/reactivescript#77 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
solidjs/reactivescript#74 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 48/100
solidjs/reactivescript#83 ·
維護者通常 1 天內回覆
查看 solidjs/reactivescript 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 62/100
TriliumNext/Trilium#12837 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 85/100
LibreChat-AI/LibreChat#18944 ·
維護者通常 1 天內回覆
-
bug root-cause:found
難度 2/5 1-3 小時 新手友好度 70/100
openchamber/openchamber#7620 · 1 則留言 ·
維護者通常 2 天內回覆
-
enhancement good first issue help wanted
難度 2/5 1-3 小時 新手友好度 82/100
Anatomik5/codetovideo#8 ·
-
[Bug] Windows Ghidra provider rejects a PATH-only JDK: bare `java.exe` probe fails with Win32 87未關閉
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆