Complication editor preview is blank when a Title/Value slot uses a Template token different from the Display name template
还没有人认领这个 Issue。
评估
调研方向
先从 AllFamiliesComplicationPreview.swift 第 266 行附近和 WatchComplicationLivePreview.swift 第 216 行附近开始,然后将它们的渲染上下文与 WatchWidgetComplicationSnapshot.swift 和 WidgetComplicationResolver.swift 进行比较。跟踪 ComplicationFormulaResolver.swift 第 52-63 行附近的代码,并验证编辑器预览使用不同于显示名称的模板来渲染插槽,其中包括相邻的静态文本。
由索引模型根据 Issue 内容生成。
描述
iOS device model, version and app version
Model Name: iPhone 16 Pro Max
Software Version: 27.0
App version: 2026.9.1 (2026.2985)
Apple Watch / watchOS: Apple Watch Series 7 (GPS), watchOS 26.6 (23U67)
Home Assistant Core Version
2026.9.2
Describe the bug
In the Apple Watch complication editor, for a complication with Source: Template, the Customize sheet lets a Title or Value slot be set to Custom and contain "Template" tokens. When such a token holds a template that is different from the complication's Display name template, the live preview shows that slot as empty. The result row under the tokens still shows the correct rendered value, and static text tokens in the same slot also disappear. On the actual Apple Watch face, the same configuration renders correctly.
From reading the code (permalinks at the release/2026.9.1/2026.2985 tag, the build I'm running), this looks like a preview-only mismatch. The preview builds its render context with only the main template:
https://github.com/home-assistant/iOS/blob/f02aa89660db509e654f65608b57f98f86b775d8/Sources/App/Settings/AppleWatch/Complications/Preview/AllFamiliesComplicationPreview.swift#L266
(same pattern in WatchComplicationLivePreview.swift#L216), while the watch renders the extra templates used by customized slots:
https://github.com/home-assistant/iOS/blob/f02aa89660db509e654f65608b57f98f86b775d8/Sources/WatchApp/Complication/WatchWidgetComplicationSnapshot.swift#L112
and so does the iPhone widget resolver:
https://github.com/home-assistant/iOS/blob/f02aa89660db509e654f65608b57f98f86b775d8/Sources/Extensions/AppIntents/Widget/Complication/WidgetComplicationResolver.swift#L109-L115
ComplicationFormulaResolver resolves a template missing from renderedTemplates as an empty string and drops static text next to an empty dynamic part, so the whole slot ends up blank:
https://github.com/home-assistant/iOS/blob/f02aa89660db509e654f65608b57f98f86b775d8/Sources/HAModels/Sources/ComplicationFormulaResolver.swift#L52-L63
To Reproduce
- Create a complication with Source: Template and a Display name template, e.g.
{{ states('sensor.a') }}. - Open Customize and set the Value slot to Custom.
- Set the slot's Template token to a different template, e.g.
{{ states('sensor.b') }}. - The row under the tokens shows the correct result, but the preview shows no value text (and no static text tokens from that slot).
- Save and check the watch face: the value is displayed correctly.
Expected behavior
The preview renders every template referenced by the slot formulas, like the watch and the widget resolver do.
Screenshots
Additional context
The gauge and gauge color templates are unaffected; only text slots with extra Template tokens.
Not a duplicate of #5831: that one is about the Corner family on the watch face with the progress bar on, while this one is only about the editor preview (the watch face renders correctly).
- 主要语言
- Swift
- 星标
- 2.4k
- 派生
- 521
- 平均合并
- 8 小时 4 分钟
- 30 天内合并 PR
- 252
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
home-assistant/iOS 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
home-assistant/iOS#5570 · 1 条评论 ·
-
bug mac
难度 2/5 1-3 小时 新手友好度 65/100
home-assistant/iOS#5009 · 1 条评论 ·
-
bug ios
难度 3/5 1-2 天 新手友好度 72/100
home-assistant/iOS#5875 ·
-
ios native-tabs-experiment
难度 3/5 1-2 天 新手友好度 55/100
home-assistant/iOS#5874 · 1 条评论 ·
-
bug ios
难度 4/5 3-5 天 新手友好度 52/100
home-assistant/iOS#5870 · 2 条评论 ·
查看 home-assistant/iOS 的全部 Issue
相似的 Issue
-
type: docs
难度 1/5 1 小时以内 新手友好度 95/100
googleapis/google-cloud-swift#971 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
mozilla-mobile/firefox-ios#35743 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
manaflow-ai/cmux#13417 ·
-
triage
难度 2/5 1-3 小时 新手友好度 84/100
ionic-team/capacitor#8616 ·