Complication editor preview is blank when a Title/Value slot uses a Template token different from the Display name template

Open Beginner friendly
#5,844 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
ios, swift
Domain
mobile

Research direction

Start with AllFamiliesComplicationPreview.swift around line 266 and WatchComplicationLivePreview.swift around line 216, then compare their render context with WatchWidgetComplicationSnapshot.swift and WidgetComplicationResolver.swift. Trace ComplicationFormulaResolver.swift around lines 52-63 and verify that the editor preview renders slots using templates different from the display name, including adjacent static text.

Written by the indexing model from the issue text.

Description

bug ios

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

  1. Create a complication with Source: Template and a Display name template, e.g. {{ states('sensor.a') }}.
  2. Open Customize and set the Value slot to Custom.
  3. Set the slot's Template token to a different template, e.g. {{ states('sensor.b') }}.
  4. The row under the tokens shows the correct result, but the preview shows no value text (and no static text tokens from that slot).
  5. 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

Image

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).

Dominant language
Swift
Stars
2.4k
Forks
521
Avg merge
8h 4m
Merged PRs (30d)
252

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from home-assistant/iOS

All issues in home-assistant/iOS

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.