Demo: fix the @Entry closure warning for showAPIConfiguration
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start by reading Demo/DemoChat/Sources/UI/Environment/APIConfiguration.swift, then inspect how Demo/App/DemoApp.swift sets showAPIConfiguration and how Demo/DemoChat/Sources/UI/Misc/MiscView.swift uses it. Build Demo to check the warning; done when it is gone and the API Configuration button still opens the screen.
索引モデルが issue の本文から書いたものです。
説明
Building Demo reports this warning:
Demo/DemoChat/Sources/UI/Environment/APIConfiguration.swift:13:45: warning: Storing a closure in '@Entry var showAPIConfiguration' may invalidate dependents on every update because closures may not be comparable. (from macro 'Entry ')
Context
EnvironmentValues.showAPIConfiguration is a () -> Void that opens the API Configuration screen.
DemoAppsets it with.environment(\.showAPIConfiguration, { isShowingAPIConfigModal = true })in itsbody(Demo/App/DemoApp.swift).MiscViewreads it for its API Configuration button (Demo/DemoChat/Sources/UI/Misc/MiscView.swift).
SwiftUI can't compare closures, so it can't tell that the value is unchanged. A new closure is created each time DemoApp.body runs, so every run counts as a change and re-evaluates the views that read the value, here MiscView. The cost is small in this app. The warning is only in the Demo build; it doesn't reach users of the package.
The same warning was reported for dateProviderValue and idProviderValue. Nothing ever set those, so they were removed.
Options
- Store a type with a stable identity instead of a bare closure, e.g. a
final classthat holds the action, so the environment value compares by identity. A plain struct wrapper would only silence the warning. - Stop using the environment for this: pass the action to
MiscViewthrough the views in between, or give it a binding toisShowingAPIConfigModal.
Done when the Demo build no longer reports the warning and the API Configuration button still opens the screen.
- 主要言語
- Swift
- スター
- 2.9k
- フォーク
- 519
- 平均マージ
- 3日 12時間
- マージ済み PR(30日)
- 11
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MacPaw/OpenAI のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
Enable batch promptsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
MacPaw/OpenAI#73 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
メンテナーはふだん 2 日以内に返信
-
Demo release check 2026-10-27: failures, skips and notes対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
MacPaw/OpenAI#478 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
swiftlang/swift-markdown#299 ·
-
area: agents follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
manaflow-ai/cmux#37234 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
bug product / functions
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信