Skip to content

feat(synchronize): upload only updated interrogations#417

Merged
QRuhier merged 7 commits into
feat/synchronize-improvementsfrom
feat/filter-interrogations-sent
Apr 27, 2026
Merged

feat(synchronize): upload only updated interrogations#417
QRuhier merged 7 commits into
feat/synchronize-improvementsfrom
feat/filter-interrogations-sent

Conversation

@QRuhier

@QRuhier QRuhier commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

During synchronization, upload only interrogations updated locally since it was last sent to the server.
Handled in local storage by adding hasBeenUpdated boolean

⚠️ API does not evolve, so it does not handle this boolean. Interrogations must be sent without it.

⚠️ Dexie migration was needed to force all existing interrogations to be sent during the first synchronization following this application update

@QRuhier
QRuhier force-pushed the feat/filter-interrogations-sent branch from 54ec2bc to 189e9da Compare April 15, 2026 13:07
Comment thread src/core/adapters/datastore/default.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bien vu d'y avoir pensé !

// Set locally the interrogation as not updated after successful upload.
return dataStore.updateInterrogation({
...localInterrogation,
hasBeenUpdated: false,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great 👍

@laurentC35 laurentC35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Une méthode plus efficace pour la migration dexie 😉

Et tes tests passeront toujours

@laurentC35

laurentC35 commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Je me dit que c'est l'occasion sans doute de passer à dexie 4:

En blindant les tests bien sûr

@QRuhier
QRuhier requested a review from laurentC35 April 17, 2026 11:38

@SimonDmz SimonDmz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the dexie migration may be unnecessary if we use a default value for hasBeenUpdated

Comment thread src/core/adapters/datastore/default.ts Outdated
/** Interrogation stored in local storage only */
export type LocalInterrogation = Interrogation & {
/** Whether the interrogation has been updated locally since it was last sent to the server. */
hasBeenUpdated?: boolean

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we define a default value too? this could replace the need of updating the whole IDB, and even remove the need of new Dexie version too 👼

…idb migration

Co-Authored-By: Simon Demazière <simon.demaziere@insee.fr>
Comment thread src/core/usecases/synchronizeData/thunks.ts
@sonarqubecloud

Copy link
Copy Markdown

@QRuhier
QRuhier merged commit 83517d4 into feat/synchronize-improvements Apr 27, 2026
8 checks passed
@QRuhier
QRuhier deleted the feat/filter-interrogations-sent branch April 27, 2026 08:40
QRuhier added a commit that referenced this pull request Jul 8, 2026
* feat(synchronize): use localStorage for getting interrogation ids (#412)

* feat(synchronize): use localStorage for getting interrogation ids

* chore: rename local storage key

* fix: clear local storage after synchro

* docs: update changelog

* bump: 3.3.1-rc-synchronization-optimization.0

* docs: fix changelog content

* build: don't cache service worker file and env variable (#420)

* bump: 3.3.1-rc-synchronization-optimization.1

* feat(synchronize): upload only updated interrogations (#417)

* feat(synchronize): upload only updated interrogations

* docs: changelog

* test: increase timeout for stress test

* test: improve types

* refactor: improve dexie migration

* feat: treat as true if hasBeenUpdated is missing & delete unecessary idb migration

Co-Authored-By: Simon Demazière <simon.demaziere@insee.fr>

* fix: set interrogation as not updated when getting it from api

---------

Co-authored-by: Laurent Caouissin <laurent.caouissin@insee.fr>
Co-authored-by: Simon Demazière <simon.demaziere@insee.fr>

* feat: efficient delete interro (#423)

Co-authored-by: Quentin Ruhier <quentin.ruhier@insee.fr>

* bump: 3.3.1-rc-synchronization-optimization.2

* feat: download only new interrogations (#426)

* feat: download only new interrogations

* docs: changelog

* bump: 3.3.1-rc-synchronization-optimization.3

* fix: do not cache main entry file (#429)

* bump: 3.3.1-rc-synchronization-optimization.4

* feat(synchronize): update interrogation questionnaire link (#427)

* feat: update questionnaire link for existing interrogations during synchro

* fix: promise not well handled

* bump: 3.3.1-rc-interrogations-questionnaire-link.0

---------

Co-authored-by: Laurent Caouissin <38245508+laurentC35@users.noreply.github.com>

* bump: 3.3.1-rc-synchronization-optimization.5

---------

Co-authored-by: Laurent Caouissin <38245508+laurentC35@users.noreply.github.com>
Co-authored-by: Laurent Caouissin <laurent.caouissin@insee.fr>
Co-authored-by: Simon Demazière <simon.demaziere@insee.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants