Skip to content
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 or .update method to reactive expression #956

Open
MarcSkovMadsen opened this issue Jul 27, 2024 · 1 comment
Open

Add .set or .update method to reactive expression #956

MarcSkovMadsen opened this issue Jul 27, 2024 · 1 comment
Labels
type-feature Feature request
Milestone

Comments

@MarcSkovMadsen
Copy link
Collaborator

MarcSkovMadsen commented Jul 27, 2024

I often have the need to update a reactive expression. Over and over again I find that I lack a .set or .update method. I need that to be able to update via callbacks, .bind or in lambda expressions. Its friction I have to create a set or update function my self.

Please add a .set method.

expression.rx.set(value) # same effect as expression.rx.value=value

Could be used as

button.on_click(expression.rx.set)

Additional Context

This is also what React does. Provides a set_value function.

@MarcSkovMadsen MarcSkovMadsen added type-feature Feature request TRIAGE User-submitted issue that hasn't been triaged yet. labels Jul 27, 2024
@philippjfr
Copy link
Member

We originally had this but then removed it because .rx.value setting seemed enough but I'd agree. Having a way to update the value with an expression rather than a statement adds a lot of convenience.

@philippjfr philippjfr removed the TRIAGE User-submitted issue that hasn't been triaged yet. label Jul 27, 2024
@philippjfr philippjfr added this to the v2.2.0 milestone Jul 27, 2024
@maximlt maximlt modified the milestones: v2.2.0, v2.x Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature Feature request
Projects
None yet
Development

No branches or pull requests

3 participants