-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Feature request: add ignoreIdentical
param to observeEvent()
#1484
Comments
In the past, I've thought of this as a property of the reactive expression (does it invalidate its dependents if its new value is the same as the old?), not the observer. (This is actually how reactive expressions originally worked in Shiny, but I soon concluded that laziness was more frequently beneficial than this "de-dupe" behavior.) You can achieve this yourself with a higher order reactive.
Seems like we might want to start corralling some of these types of things into a shiny reactive extras package (or contribute to Hadley's shinySignals package)... |
Your beautifully elegant solutions for these things always amaze me. I agree it'd be nice to have a place that aggregates a lot of these more complex constructs that achieve commonly needed results in shiny. I remember the |
Closing because a workaround was accepted. |
I thought I understood shiny reactive exressions quite well till I saw this Joe Cheng's master piece snippet in response to @daattali 's equally valuable question.
I am not sure how this works. How is the invalidation happening here? How does the assignment operator help? |
I often use
observeEvent(x, ...)
when I want to tell shiny that a reactive code block should be executed whenever a specific valuex
changes. UsuallyobserveEvent()
does exactly what I want it to do, but because it gets fired whenx
gets invalidated, then it can also fire whenx
hasn't changed at all. I realize this is the correct behaviour based on how reactivity works, but in my opinion it's easier for people to think of it as only firing whenever the value changes rather than gets invalidated. So I was wondering if it'd be possible to add a parameter toobserveEvent()
that will do that?Example:
It wouldn't be too far-fetched to think that the observer would only get run when
num5()
changes. It's wrong, but it can be useful to want to do that.I realize this may be a strange request that doesn't really fit the reactivity model, and fully accept any incoming judgment if this is a dumb idea
The text was updated successfully, but these errors were encountered: