Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Android: placing a server-driven Dynamic Widget fetches from the server twice

Aperta
#345 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
android, kotlin, react-native

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug platform:Android Widget

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:

  1. enqueuePeriodic(...) enqueues a PeriodicWorkRequest with no initial delay. WorkManager runs the first execution of a periodic request as soon as its constraints are met, not after one interval.
  2. requestImmediateUpdate(...) (when runImmediately is true, which recompute() passes for a scope with no previous schedule) enqueues a separate expedited one-time request under the _once work 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.

Lingua principale
TypeScript
Stelle
850
Fork
50
Merge medio
15h 13m
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di callstackincubator/voltra

Tutte le issue di callstackincubator/voltra

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.