Skip to content

Commit

Permalink
fix: Links' onLogin should be awaited
Browse files Browse the repository at this point in the history
The `onLogin` for a link is async, so it should be awaited to ensure
that everything is initialized before we actually use the link
  • Loading branch information
paultranvan committed Jan 29, 2025
1 parent b8c1280 commit c8db4a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/cozy-client/src/CozyClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,7 @@ instantiation of the client.`
*
* @param {Array<object>} links - The links to handle
*/
setLinks(links) {
async setLinks(links) {
this.links = links
? links
: [new StackLink({ performanceApi: this.performanceApi })]
Expand All @@ -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()
}
}
}
Expand Down

0 comments on commit c8db4a5

Please sign in to comment.