From 813017ee63f39fd0ec859dac50243c92a7b6c4f4 Mon Sep 17 00:00:00 2001 From: Ldoppea Date: Wed, 4 Sep 2024 17:25:26 +0200 Subject: [PATCH] revert: Remove `ignoreWarmup` option Previous implementation was from a misunderstanding of CozyPouchLink mechanisms As we don't need to specify warmup queries in CozyPouchLink instanciation, we don't need the `ignoreWarmup` as we would result to the same behavior of having no warmup queries Warmup queries concept is meant to be removed into the future as we won't be able to use them when offline and the scenario that needed them (cozy-banks and cozy-drive apps) does not exist anymore This replies to https://github.com/cozy/cozy-client/pull/1506#discussion_r1716561921 Related commit: bb43ae986139aac12f286e6a7011c5ff104addc8 --- packages/cozy-pouch-link/src/CozyPouchLink.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/cozy-pouch-link/src/CozyPouchLink.js b/packages/cozy-pouch-link/src/CozyPouchLink.js index 32d35b7ea9..e900d39cd4 100644 --- a/packages/cozy-pouch-link/src/CozyPouchLink.js +++ b/packages/cozy-pouch-link/src/CozyPouchLink.js @@ -87,7 +87,7 @@ class PouchLink extends CozyLink { constructor(opts) { const options = defaults({}, opts, DEFAULT_OPTIONS) super(options) - const { doctypes, doctypesReplicationOptions, ignoreWarmup } = options + const { doctypes, doctypesReplicationOptions } = options this.options = options if (!doctypes) { throw new Error( @@ -100,7 +100,6 @@ class PouchLink extends CozyLink { this.storage = new PouchLocalStorage( options.platform?.storage || platformWeb.storage ) - this.ignoreWarmup = ignoreWarmup /** @type {Record} - Stores replication states per doctype */ this.replicationStatus = this.replicationStatus || {} @@ -366,7 +365,7 @@ class PouchLink extends CozyLink { return forward(operation) } - if (!this.ignoreWarmup && (await this.needsToWaitWarmup(doctype))) { + if ((await this.needsToWaitWarmup(doctype))) { if (process.env.NODE_ENV !== 'production') { logger.info( `Tried to access local ${doctype} but not warmuped yet. Forwarding the operation to next link`