From b939e417f0fbd88b6957ae300279ec881fd49599 Mon Sep 17 00:00:00 2001 From: Crash-- Date: Thu, 13 Apr 2023 14:54:22 +0200 Subject: [PATCH] fix: Correct usage of fetchQueryAndGetFromState --- src/components/pushClient/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/pushClient/index.js b/src/components/pushClient/index.js index 21e8546e74..800cbad6c2 100644 --- a/src/components/pushClient/index.js +++ b/src/components/pushClient/index.js @@ -19,13 +19,14 @@ export const DESKTOP_BANNER = 'desktop_banner' export const NOVIEWER_DESKTOP_CTA = 'noviewer_desktop_cta' export const isClientAlreadyInstalled = async client => { - const { data } = await client.fetchQueryAndGetFromState( - Q('io.cozy.settings').getById('clients'), - { + const query = { + definition: Q('io.cozy.settings').getById('clients'), + options: { as: 'io.cozy.settings/clients', fetchPolicy: CozyClient.fetchPolicies.olderThan(30 * 1000) } - ) + } + const { data } = await client.fetchQueryAndGetFromState(query) return Object.values(data).some( device => get(device, 'attributes.software_id') === DESKTOP_SOFTWARE_ID )