Quick repeated calls to `await @Fetch*.load(...).task` inside `.task` modifier can result in stale query results
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 50/100
Línea de trabajo
Start by running the attached SubscriptionTaskReloadRaceApp reproduction and inspect the calls to FetchSubscription.task inside the view's .task modifier. Exercise rapid A-to-D load changes with a replacement delay below 100ms, then trace cancellation versus the new load; done means the @Fetch* results consistently match the latest load call.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
(originally reported in Slack #sqlite-data channel)
Quick repeating calls to load can occur naturally in situations like handling a deep link on application start: the application first loads the initial/default query, followed by a quick reload to process the deep link.
Investigation reveals that awaiting the FetchSubscription.task is what triggers this bug. There's a race between the cancellation of the task (which will occur when the await is situated inside a view's .task modifier) and the handling of the new load. If the cancel wins, it prevents the new load from succeeding, resulting in stale data.
See attached demo app for a controllable repro - SubscriptionTaskReloadRaceApp_1.12.0.zip. The app cycles between query states A -> B -> C -> D, which each have their respective expected results ([A,A..], [B, B, ..], etc.). The app will halt whenever displayed results do not match expected results based on the most recent load call. Lowering the "Replacement load delay" to below 100ms reliably triggers the mismatch/stale results state. repro video
Checklist
- I wrote this in my own words, and aimed to be as succinct as possible, even if I used AI to help research its content.
- I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
- I have determined whether this bug is also reproducible in a vanilla GRDB project.
- If possible, I've reproduced the issue using the
mainbranch of this package. - This issue hasn't been addressed in an existing GitHub issue or discussion.
Expected behavior
Results provided by the @Fetch* wrapper always match with the latest load call.
Actual behavior
Results provided by the @Fetch* wrapper can get stuck on results corresponding to a previous load call instead of the latest.
Reproducing project
SubscriptionTaskReloadRaceApp_1.12.0.zip
SQLiteData version information
1.12.0
Sharing version information
2.10.1
GRDB version information
7.11.1
Destination operating system
iOS 27
Xcode version information
27.0
Swift Compiler version information
6.4
- Lenguaje dominante
- Swift
- Estrellas
- 1.9k
- Forks
- 154
- Merge medio
- 2 d 18 h
- PR fusionados (30 d)
- 1
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pointfreeco/sqlite-data
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
pointfreeco/sqlite-data#551 ·
-
Child records deleted locally when their parent's save failed with `quotaExceeded`Posiblemente ocupada @jalalawqati la tomó hace 21 días. Abiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
pointfreeco/sqlite-data#547 · 2 comentarios · 1 reacción ·
-
CloudKit data loss after deleting then re-inserting record with the same UUIDPosiblemente ocupada @jsutula la tomó hace 208 días. Abiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
pointfreeco/sqlite-data#418 · 2 comentarios ·
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
pointfreeco/sqlite-data#356 ·
-
Violation of “last edit wins” conflict resolution strategyPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
pointfreeco/sqlite-data#354 · 2 comentarios ·
Todos los issues de pointfreeco/sqlite-data
Issues similares
-
#️⃣ REX and feebacks 🔍 triage 🧑💻 Developer eXperience 🧰 library
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Orange-OpenSource/ouds-ios#1795 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
RodnaPamet/agrent-ios#172 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug iOS 🍎 ui/ux
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
MerginMaps/mobile#4744 ·
Los mantenedores suelen responder en 1 día
-
bug milestone-qa mobile
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
lognorman20/monaco#3519 ·