-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent "ready" events between dev and prod environments #6
Comments
When checked out and running locally, neither the dev environment nor the prod build alert. The Could it be you have a valid localStorage, already signed in, Xumm SDK session on your prod URL, and not locally? Then on prod the SDK will load your existing session and fire -- Edit: Here's an ugly working sample with React working perfectly both in dev as prod build: |
I tried running both the development and production environments in incognito mode in the browser (Chrome, Safari), but the alert() is executed only in the production environment. All environments are running on |
I see that in XummSDK-React-Demo, ready is working in both development and production (preview) environments. |
I'm not getting the alert in prod either, in your example 😇 |
Found it. Wrapping You then refer to The trick is just to do this: useMemo(() => {
const xumm = new Xumm("...")
xumm.on('ready', () => {
console.log('Xumm ready')
})
}, []) |
Oh, I didn't think of that way 🤣. So it is working perfectly. Thank you very much. Is there something outside of this library that causes the event handling to break? |
No, it's simply the fact that in your example the |
I did some research. Xumm-Universal-SDK/src/index.ts Lines 459 to 466 in 140d410
This problem seems to occur only when the following process resolves. Xumm-Universal-SDK/src/index.ts Line 462 in 140d410
In addition, the following cases will also not work _classes.XummPkce?.on("loggedout", () => {
this.emit("ready");
resolve()
}); It works in the following cases this.emit("ready");
_classes.XummPkce?.on("loggedout", () => resolve()); |
Thank you for your research, but can you explain this a bit more?
Does not work when? Vs.
I'm missing some context here. I don't understand how this relates to the previous messages in this issue, and my message with the solution? |
React's StrictMode seemed to be a major factor. If StrictMode is disabled during development, the desired behavior is achieved. |
ready event(on('ready',...)) is working as expected in the React production environment, but not in the development environment.
I don't know if this is a problem with React or with this library, but I will share.
You can check the behavior in the following repository
https://github.com/develoQ/react-xumm-on-ready
Development environment
yarn start
Production environment
yarn build
npx serve -s build
The ready event executes alert().
The alert() is executed in the production environment, but not in the development environment.
The text was updated successfully, but these errors were encountered: