Move the Demo app from ObservableObject to the Observation framework
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 重构
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- ios, macos, swift
调研方向
Start with APIProvidedView.init, where the stores are created, then read ChatStore and ResponsesStore and the list of stores in the issue. Migrate each ObservableObject to @Observable, update view ownership from @StateObject/@ObservedObject to @State/@Bindable, and remove ChatStore.selectedConversationPublisher. The work is done when the listed stores no longer use ObservableObject, store creation happens once, and the Demo builds and runs on iOS 17/macOS 14.
由索引模型根据 Issue 内容生成。
描述
The Demo app's stores are ObservableObjects. A view that observes one redraws whenever any of its @Published properties changes, whatever the view shows. While a reply streams, ChatStore and ResponsesStore change dozens of times a second, so every view observing them redraws that often too, the app's root included. In one streamed Chats reply (iOS 27 simulator), ChatStore changed 381 times, and APIProvidedView, ContentView, ChatView and the conversation list each redrew 334 times.
With the Observation framework (@Observable), a view redraws only when a property it read changes. The Demo targets iOS 17 and macOS 14, where Observation is available.
The goal is to move the Demo to Observation first, and only then decide whether anything still updates too often and needs pacing. This came up in the review of #475: the conversation list redraws on every streamed change.
Types to move
- Streaming stores:
ChatStore,ResponsesStore - Other stores:
AssistantStore,FilesStore,ImageStore,MCPToolsStore,MiscStore,SpeechStore,ResponsesSettingsStore - View helper:
ChatMessagesPacer, which paces the messages handed to ExyteChat'sChatView
Notes
- Views:
@StateObjectbecomes@State, and@ObservedObjectbecomes a plain property, or@Bindablewhere the view needs bindings (ChatViewbinds$store.conversationsand$store.isSendingMessage). Views that only pass a store on, such asContentView,MiscViewandAssistantsViewwithChatStore, then no longer redraw when it changes. - Creating the stores:
APIProvidedViewcreates them in itsinit.@StateObjectevaluates its initial value once, but@Stateevaluates it on everyinitand keeps only the first, andMCPToolsStorestarts connecting in its owninit. The stores need to be created once some other way. - Combine:
ChatStore.selectedConversationPublisheris built on$selectedConversationID, which@Observabledoesn't provide. Nothing uses it, so it can go.
- 主要语言
- Swift
- 星标
- 2.9k
- 派生
- 519
- 平均合并
- 2 天 14 小时
- 30 天内合并 PR
- 8
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MacPaw/OpenAI 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
MacPaw/OpenAI#73 · 1 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 35/100
维护者通常 2 天内回复
-
Wiz-remediation
难度 5/5 一周以上 新手友好度 1/100
维护者通常 2 天内回复
-
Check the HTTP status code for JSON responses可能已有人在做 @mvanhorn 于 16 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 2 天内回复
相似的 Issue
-
needs-triage S3: minor
难度 2/5 1-3 小时 新手友好度 72/100
manaflow-ai/cmux#28422 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 65/100
SwiftOldDriver/iOS-Weekly#5480 ·
-
Seed a JRNYAx price before the last close so asset-detail S1.3 doesn't fail from 08:00Z to the open未关闭bug tests
难度 2/5 1-3 小时 新手友好度 83/100
lognorman20/monaco#7231 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 5 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 7 天内回复