-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
Change set_state
comparison method
#1248
Comments
IIRC React uses I'd recommend trying to replicate this behavior instead of relying on Perhaps there are some more edge cases that we can deal with in Python that could make this a bit more usable though. |
In the interests of usability, I think it's better to take the Currently, whenever I'm using ReactPy I'm constantly forced into writing my own Exceptions from |
Current Situation
Currently ReactPy using a function called
strictly_equals
to determine ifset_state
is setting itself to a duplicate value.This sometimes relies on python's
is
keyword to check identity.Proposed Actions
Using
is
to check equality in Python doesn't exactly behave the same as the javascript equivalent (Object.is
). The currentset_state
design is effectively if the old/new memory references are the same, which doesn't equate to whether their values are the same. This is honestly a bit annoying, and results in re-renders in scenarios were it was completely unneeded.Python's
__eq__
method is far more similar to JavaScript than Python'sis
. So realistically, we should be attempting to do an__eq__
check whenever possible.Related Issues
The text was updated successfully, but these errors were encountered: