Conversation
Problemet var bruken av combineLatest i offline-capable-search-service. combineLatest emitter når én av kildene emitter, så når man byttet miljø emitter den med forrige observasjon fra miljøet du sendte inn i, og lagrer denne i feil miljø.
Litt skeptisk til json-endringen, må testes...
Forenkler initialisering og connection-håndtering
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-water-056410803-956.westeurope.azurestaticapps.net |
There was a problem hiding this comment.
Pull request overview
This PR improves the offline SQLite layer to better separate data between environments (via app_mode) and to simplify/strengthen initialization and connection handling in the hybrid app lifecycle.
Changes:
- Adds a DB schema upgrade (v6) that recreates tables so
registrationuses a composite PK(reg_id, app_mode)and sync time uses(app_mode, lang). - Refactors SQLite usage to run operations through a
withConnection()helper and adds locking intended to prevent close/open interference during pause/resume. - Moves SQLite initialization out of
AppComponentand into anAPP_INITIALIZER, and adjusts offline save/delete subscriptions to avoid reprocessing on appMode changes.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
src/app/core/services/sqlite/sqlite.service.ts |
DB v6 migration + new locking/connection wrapper + query/pagination adjustments |
src/app/core/services/search-registration/offline-capable-search-service.ts |
Uses withLatestFrom to avoid duplicate writes when appMode changes |
src/app/app.providers.ts |
Initializes SqliteService via provideAppInitializer on hybrid only |
src/app/app.component.ts |
Removes SQLite init responsibility from the root component |
Comments suppressed due to low confidence (1)
src/app/core/services/sqlite/sqlite.service.ts:432
parseLimituses truthy checks (if (c.NumberOfRecords && c.Offset)), which skips valid values likeOffset = 0(orNumberOfRecords = 0). Use explicit null/undefined checks so pagination works correctly when offset is zero.
private parseLimit(c: SearchCriteria) {
if (c.NumberOfRecords && c.Offset) {
return `LIMIT ${c.NumberOfRecords} OFFSET ${c.Offset}`;
} else if (c.NumberOfRecords) {
return `LIMIT ${c.NumberOfRecords}`;
}
return '';
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-water-056410803-956.westeurope.azurestaticapps.net |
1 similar comment
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-water-056410803-956.westeurope.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-water-056410803-956.westeurope.azurestaticapps.net |
- Legg til fail-fast logikk i withConnection om sqlite ikke er initialisert - Fiks kommentar Agent-Logs-Url: https://github.com/NVE/regObs4/sessions/1eb057f8-f130-4ea5-a330-f8650d23c679 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-water-056410803-956.westeurope.azurestaticapps.net |
withConnection()omthis.sqliteikke er initialisert✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.