-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add set methods #58
Add set methods #58
Conversation
This may be too jank. This code would not work as expected. @flare.button()
def button():
...
a = button.set_label("1234")
b = a.set_label("a")
c = a.set_label("b")
print(button.label) # None
print(a.label) # b
print(b.label) # b
print(c.label) # b |
Another solution is requiring a method to be called before any changes to a button. Like |
Now whenever you mutate anything it clones. Cloning is at least 5x faster than the serializing method so its quite cheap really. |
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.
Cloning go brrrrr
This PR also optimizing how cloning works so components created with a decorator are never mutated. Im not sure how to best document this.
closes #47