iOS: `clearWidget` and logout keep the per-instance ETag and status of configurable widgets

Open
#398 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@huytdps13400 is already working on this.

Since Dec 1, 2026.

  • #402 by @huytdps13400 — open

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
android, ios, kotlin, react-native, swift, typescript
Domain
cli, mobile-dev

Research direction

Start in packages/ios-client/ios/app/VoltraWidgetService.swift at clearFetchedState and clearWidgetServerState, where status and ETag are cleared only for WidgetScope.of(widgetId). Use DynamicWidgetPropsStore.instanceKeys(for:) in packages/ios-client/ios/shared/DynamicWidgetPropsStore.swift to read the instance keys before clearing props, then clear each instance's status and ETag, following the Android WidgetServerUpdateCoordinator.kt pattern. Done when a logout or clearWidget leaves no instance ETag or serverUpdate status behind, and DynamicWidgetServerUpdateRunner.swift no longer sends a stale If-None-Match.

Written by the indexing model from the issue text.

Description

Found while fixing #381, by reading the code. Not reproduced on a device yet.

What happens

On iOS, clearing a server-driven Dynamic Widget clears the ETag and the env.serverUpdate status of the widget scope only. A widget with configuration parameters fetches per instance (ADR 0007), and each instance has its own ETag and status record. Those stay behind:

So after a logout, an instance's next fetch still sends the old If-None-Match. If the server answers 304, the runner records a success without committing props, and the instance shows {} until the server's data changes. Its env.serverUpdate also keeps the old status instead of going back to never.
https://github.com/callstackincubator/voltra/blob/cee9f6739e256c4b8885207373823deb48525b1c/packages/ios-client/ios/shared/DynamicWidgetServerUpdate/DynamicWidgetServerUpdateRunner.swift#L99-L100

Expected

The same as Android, which reads the instance keys before clearing the props, then clears each instance's status and ETag too:

DynamicWidgetPropsStore.instanceKeys(for:) already exists on iOS for this.
https://github.com/callstackincubator/voltra/blob/cee9f6739e256c4b8885207373823deb48525b1c/packages/ios-client/ios/shared/DynamicWidgetPropsStore.swift#L90

Dominant language
TypeScript
Stars
865
Forks
50
Avg merge
2d 22h
Merged PRs (30d)
18

Getting set up

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 callstackincubator/voltra

All issues in callstackincubator/voltra

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.