Navigator.locks : The provided callback is no longer runnable

609 Views Asked by At

To avoid concurrency on a vue api service client, I added locks. While the locks works great, the first loading of the apps emits multiple errors saying "Failed to execute 'invoke' on 'LockGrantedCallback': The provided callback is no longer runnable.", and some data is missing.

All the service functions works as following :

async myfunc() {
    await navigator.locks.request("data", async () => {
      if (isNil(store.data)) {
        await this.updateToken(); // update this.token.accessToken
        let response = await Get(dataUrl, this.token.accessToken);
        store.data = response.data;
      }
    });
    return store.data;
} 

Some more details on the service :

The service is initialized in App.vue as following

provide() {
  return {
    myService: new MyService(msal),
  };
}

All component using the service receive it as an injected instance

inject: ['myService']

What am I doing wrong?

0

There are 0 best solutions below