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

Abierto
#398 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
android, ios, kotlin, react-native, swift, typescript
Área
cli, mobile-dev

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
TypeScript
Estrellas
865
Forks
50
Merge medio
2 d 22 h
PR fusionados (30 d)
18

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de callstackincubator/voltra

Todos los issues de callstackincubator/voltra

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.