Android: placing a server-driven Dynamic Widget fetches from the server twice
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- android, kotlin, react-native
- Domain
- ai-infra-agents, mobile-dev
Research direction
Start in packages/android-client/android/src/main/java/voltra/dynamicwidget/serverupdate/DynamicWidgetServerUpdateScheduler.kt, reading schedule(), enqueuePeriodic() and requestImmediateUpdate(), and check whether the periodic request is enqueued without an initial delay. Confirm the double fetch by counting requests with adb logcat -s VoltraDynamicServerSched. Done means one request per placement, with VoltraWidgetUpdateScheduler checked for the same pattern.
Written by the indexing model from the issue text.
Description
Follow-up to #293, where the reporter noticed it.
What happens
Placing a server-driven Dynamic Widget (a widget with both entry and serverUpdate) makes two identical HTTP requests to the server within the same second.
Reported on 2.3.0 with a physical device and a PHP endpoint logging every hit: two requests with the same timestamp each time the widget is added.
Likely cause (from reading the code, not yet confirmed on a device)
DynamicWidgetServerUpdateScheduler.schedule() does two things for a scope that has just been scheduled:
enqueuePeriodic(...)enqueues aPeriodicWorkRequestwith no initial delay. WorkManager runs the first execution of a periodic request as soon as its constraints are met, not after one interval.requestImmediateUpdate(...)(whenrunImmediatelyis true, whichrecompute()passes for a scope with no previous schedule) enqueues a separate expedited one-time request under the_oncework name.
Those are two different unique work names, so nothing collapses them, and both run DynamicWidgetServerUpdateRunner straight away.
Relevant code: packages/android-client/android/src/main/java/voltra/dynamicwidget/serverupdate/DynamicWidgetServerUpdateScheduler.kt (schedule, enqueuePeriodic, enqueueOneTime).
Expected
One fetch when a widget is placed.
Possible fix
Give the periodic request an initial delay of one interval (setInitialDelay) whenever the immediate one-time request is also enqueued, so the one-time request is the placement fetch and the periodic one takes over afterwards. The one-time request is the better one to keep because it is expedited.
VoltraWidgetUpdateScheduler (payload-driven widgets) also uses enqueueUniquePeriodicWork plus a requestImmediateUpdate; worth checking whether it has the same shape.
How to verify
Pin a server-driven Dynamic Widget on a device or emulator and count requests on the server (or adb logcat -s VoltraDynamicServerSched VoltraClientGlanceWidget). Expect one request per placement after the fix.
- Dominant language
- TypeScript
- Stars
- 844
- Forks
- 45
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 27
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
-
platform:iOS
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
callstackincubator/voltra#340 · 1 comment · 1 reaction ·
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
-
enhancement platform:Android platform:iOS
Difficulty 5/5 Over a week Newbie friendliness 8/100
callstackincubator/voltra#343 ·
Maintainers usually reply within 1 day
-
iOS server-rendered home widgets can't follow light/dark mode (`theme` param is always "light")Openplatform:iOS
Difficulty 5/5 Over a week Newbie friendliness 35/100
callstackincubator/voltra#337 ·
Maintainers usually reply within 1 day
All issues in callstackincubator/voltra
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
anomalyco/opencode#56380 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
BUG | `MCP 服务器` | 全局层行的停用/启用与删除报 404 server row not found,编辑保存会在 profile 层复制出重复行Possibly taken @w6242652 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Chocobozzz/PeerTube#7832 ·
Maintainers usually reply within 3 days
-
Pay to use?Open
Difficulty 1/5 Under an hour Newbie friendliness 66/100
darkreader/darkreader#16108 · 1 comment ·
Maintainers usually reply within 2 days