From c8db4a5004306b5fed7e05fa64e6830c7d78120b Mon Sep 17 00:00:00 2001 From: Paul Tran-Van Date: Wed, 29 Jan 2025 09:56:59 +0100 Subject: [PATCH] fix: Links' onLogin should be awaited The `onLogin` for a link is async, so it should be awaited to ensure that everything is initialized before we actually use the link --- packages/cozy-client/src/CozyClient.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cozy-client/src/CozyClient.js b/packages/cozy-client/src/CozyClient.js index 197a04033..ef98bc136 100644 --- a/packages/cozy-client/src/CozyClient.js +++ b/packages/cozy-client/src/CozyClient.js @@ -1851,7 +1851,7 @@ instantiation of the client.` * * @param {Array} links - The links to handle */ - setLinks(links) { + async setLinks(links) { this.links = links ? links : [new StackLink({ performanceApi: this.performanceApi })] @@ -1864,7 +1864,7 @@ instantiation of the client.` // Thus, we call the link's onLogin methods for (const link of this.links) { if (link.onLogin) { - link.onLogin() + await link.onLogin() } } }