'client' declared and assigned in different scopes. Possible asynchronous race condition

Hello,

when I run the sample app under https://github.com/freshworks-developers/request-method-samples/tree/main/sample-app I get the FDK warning
“‘client’ declared and assigned in different scopes. Possible asynchronous race condition.”.
Is it safe to ignore this warning and is there any way to hide it? I would rather not have a non-fixable warning in my code if possible.

var client;

(async function init() {
  client = await app.initialized();
  client.events.on('app.activated', renderStarWarsInfo);
})();

Hi @chrism,

Greetings!

It is safe to use it like this because all the other codes will run after initializing and since it’s a one-time process, it will cause no problem…

It would be fine if the Freshworks devs did this in the sample app… :wink:

Sometimes I used to do this

  window.client = await app.initialized();

And concluded that it would be acceptable if the developer from Freshworks utilized it as a sample in the GitHub code.

Hope this helps :crossed_fingers:

Have a nice day, bye :wave:

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.