Sibling ForEach blocks with the same IDs share Compose keys since #533
メンテナーはふだん 5 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 22/100
調査の方向性
The bug is in how unrolled ForEach content gets Compose keys, so start from the key computation that uses currentCompositeKeyHash and the ForEach identity namespace, and from the rememberSaveable path that restores state under that key. Reproduce with two sibling ForEach blocks that share IDs, then check whether two Row(id: 1) views end up with the same key. Done means siblings get distinct keys and the TabView re-entry case still keeps its state. Pick the discriminator with a maintainer first, since the reporter's approach is still open.
索引モデルが issue の本文から書いたものです。
説明
Since #533, unrolled ForEach content is keyed by identity alone. That fixed the TabView remount, but two sibling ForEach blocks with the same IDs now get the same Compose keys:
struct Row: View {
let list: String
let id: Int
@State var taps = 0
var body: some View {
Text("\(list) \(id): \(taps)").onTapGesture { taps += 1 }
}
}
VStack {
ForEach([1, 2], id: \.self) { Row(list: "favorites", id: $0) }
ForEach([1, 2, 3], id: \.self) { Row(list: "all", id: $0) }
}
Both Row(id: 1) views get the same currentCompositeKeyHash, so rememberSaveable restores them under one key and a row can take the other block's state. In a Skip Fuse app (favorites and recents of the same items in one LazyVStack), this trapped in syncState on a null StateSupport after scrolling, on an Android 16 emulator with skip-ui 1.62.0.
Keying by (ForEachIdentityNamespace, identity), as before #533, separates siblings, but the namespace is remembered, so it changes on re-entry, which is the TabView case. A discriminator that survives re-entry, such as the ForEach's position among its parent's children combined with the identity, would fix both. Happy to open a PR once you've picked an approach.
Found with Claude Code while porting a SwiftUI app to Android with Skip Fuse.
- 主要言語
- Swift
- スター
- 332
- フォーク
- 91
- 平均マージ
- 4日 9時間
- マージ済み PR(30日)
- 10
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
skiptools/skip-ui のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 5 日以内に返信
skiptools/skip-ui の issue をすべて見る
似ている issue
-
area: agents
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
manaflow-ai/cmux#50925 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 66/100
521xueweihan/HelloGitHub#4445 ·
-
comment-reshape
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
callstackincubator/ai#378 ·
メンテナーはふだん 1 日以内に返信