You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the example above, clicking the add button will add a number to the list and the text output will update as expected.
Remove function unexpected effect
When clicking the remove button, the reactive variable is updated (see console output), but nothing is triggered so the UI won't update until another process like the add button shows the new output.
Explanation
The reason is that x = check() is not making a copy of the reactive value, but just transferring the ownership, which is normal python behaviour. However, the fact that it is then possible to actually update the reactive variable but not evoking a trigger, is unexpected and counterintuitive. I suggest this should either result in an error, or propagate as expected.
When using x = check().clone() instead, the app works as expected. Again, I would argue this is the correct syntax, but the shown alternative should not allow to silently change the reactive variable without a trigger.
Error Messages (if any)
Environment
Windows 10
Chrome
The text was updated successfully, but these errors were encountered:
As you said, you can use .clone() to produce a new points. You may also get around it by calling check.unset() before you call check.set(value). Example app
Component
Reactive Programming
Severity
P2 - Medium (workaround exists)
Shiny Version
1.3.0
Python Version
3.11.1
Minimal Reproducible Example
Behavior
Add function works as expected
In the example above, clicking the
add
button will add a number to the list and the text output will update as expected.Remove function unexpected effect
When clicking the
remove
button, the reactive variable is updated (see console output), but nothing is triggered so the UI won't update until another process like theadd
button shows the new output.Explanation
The reason is that
x = check()
is not making a copy of the reactive value, but just transferring the ownership, which is normal python behaviour. However, the fact that it is then possible to actually update the reactive variable but not evoking a trigger, is unexpected and counterintuitive. I suggest this should either result in an error, or propagate as expected.When using
x = check().clone()
instead, the app works as expected. Again, I would argue this is the correct syntax, but the shown alternative should not allow to silently change the reactive variable without a trigger.Error Messages (if any)
Environment
The text was updated successfully, but these errors were encountered: