-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix #3307: do nothing when calling init multiple times #3320
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! I think it may be a better idea to throw an error when init
is called twice rather than silently returning, though - that's probably a mistake someone would want to know about, and I think it's a bit weird for the arguments that get passed to init
to just be silently ignored.
I think you're right, if a maintainer wants the change, I'll do it! |
In fact, I think it would break in React like website, as React launches startup function twice in dev mode, meaning However, having an error log might be great |
I don't really know anything about React. Is it not possible to just call |
You can keep track of course, and that's what apps use. However internally (and only in dev mode) they launch twice every component initialisation and destruction to assert you're cleaning the used items I might be not clear, but it'll call init twice, I'm not 100% sure it would break, but it needs to be taken into account I guess? |
Can we extend the same check to
Liamolucko has merge rights, currently he is probably your best bet to get anything merged in this repo. |
Thanks for the heads up @daxpedda |
More precision on this: It would not break React website. But I think it would break the dev workflow, see React Strict Mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I can see how having it silently return would be a lot more convenient in situations like that, so I'll go ahead and merge this as-is. Thanks, and sorry I took so long to make up my mind...
Also, thanks @daxpedda for mentioning initSync
, I had totally forgotten about it.
It's alright, thanks 👌 |
No description provided.