iOS: `clearWidget` and logout keep the per-instance ETag and status of configurable widgets
Maintainers usually reply within 1 day
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:
- Logout,
clearFetchedState: it clears every instance's props throughDynamicWidgetPropsStore.clearDynamicWidgetProps, but status and ETag only forWidgetScope.of(widgetId).
https://github.com/callstackincubator/voltra/blob/cee9f6739e256c4b8885207373823deb48525b1c/packages/ios-client/ios/app/VoltraWidgetService.swift#L110-L121 clearWidget,clearWidgetServerState: same.
https://github.com/callstackincubator/voltra/blob/cee9f6739e256c4b8885207373823deb48525b1c/packages/ios-client/ios/app/VoltraWidgetService.swift#L173-L181
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:
- https://github.com/callstackincubator/voltra/blob/cee9f6739e256c4b8885207373823deb48525b1c/packages/android-client/android/src/main/java/voltra/WidgetServerUpdateCoordinator.kt#L95-L115
- https://github.com/callstackincubator/voltra/blob/cee9f6739e256c4b8885207373823deb48525b1c/packages/android-client/android/src/main/java/voltra/WidgetServerUpdateCoordinator.kt#L140-L149
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
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from callstackincubator/voltra
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
callstackincubator/voltra#376 ·
Maintainers usually reply within 1 day
-
refactor-scout
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
callstackincubator/voltra#308 ·
Maintainers usually reply within 1 day
-
refactor-scout
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
callstackincubator/voltra#307 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
callstackincubator/voltra#400 ·
Maintainers usually reply within 1 day
-
Keep Edit Widget choices when an app moves an existing configurable widget to VoltraPossibly taken @mrevanzak claimed this 9 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 40/100
callstackincubator/voltra#393 ·
Maintainers usually reply within 1 day
All issues in callstackincubator/voltra
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
earendil-works/gondolin#222 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
endora-commerce/endora-commerce#2203 ·
Maintainers usually reply within 1 day
-
enhancement priority:medium ready-for-human
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
wondermoney/wondermoney#1079 ·
Maintainers usually reply within 1 day