Error On reload of page on Next Js application :- r [ASCError]: ASCWebSDK: Only one instance of the SDK Web Client can be created

I am using the Next Js app for Amity integration. I have installed the JS-SDK
npm install @amityco/js-sdk --save.

Whenever I am reloading the page, its giving me an error
:- r [ASCError]: ASCWebSDK: Only one instance of the SDK Web Client can be created.

Here is a sample example of how I am using it.
In pages/ _app.js

const client = new AmityClient({
  apiKey: 'API_KEY',
  apiRegion: ApiRegion.SG,
});

function MyApp({ Component, pageProps }) {
  return (
    <ThemeProvider theme={theme}>
      <Component {...pageProps} client={client} />
    </ThemeProvider>
  );
}

It works fine when moving across different pages, but when I reload it gives the error.
:- r [ASCError]: ASCWebSDK: Only one instance of the SDK Web Client can be created.

Inside Components/community.js → useEffect hook ( accepting client as props in community.js )

client.registerSession({
      userId: '1234',
      displayName: 'TestName',
      authToken,
    });
    const postLiveObject = await PostRepository.postForId(
      '1234',
    );
    await postLiveObject.once('dataUpdated', (model) => {
      console.log('Post', model);
    });

Its not printing console.log(‘Post’, model);

How to resolve this on the Next Js app.

Hi @SUshant ,

May I know which version JS SDK you are using?

Thank you,
Amity Support

@amityco/js-sdk”: “^5.36.0”,
“next”: “^10.0.2”,
“react”: “^17.0.1”,

@amitysupport
Is JS-SDK compatible with the Next.Js web application? Or should I move to TypeScript SDK?

It is compatible, please see our sample repo here: GitHub - AmityCo/Amity-Social-Cloud-NextJS-Sample-App: Amity Social Cloud offers Chat and Social SDKs to streamline app development. Dive into our UI Kits and sample apps in our repositories to spark your creativity. To learn more, visit amity.co.

If you’re still facing the issue, please let us know.