Replies: 3 comments 1 reply
-
If this is a bug, then we should fix it. We do discourage using mo.state, but it has its uses. |
Beta Was this translation helpful? Give feedback.
-
Currently it's a bug, yes. I propose that instead of the embedded behavior being changed the normal behavior should be changed. |
Beta Was this translation helpful? Give feedback.
-
|
...I just realized a version of mo.state that doesn't update the getters already exists and is called a python dictionary, so no changes are necessary to mo.state's design. I'll make a bug report for the embedding bug with a minimal code example when I get the chance (next week probably) since it seems that more than just |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently in a Marimo notebook when a cell calls a
mo.statesetter, all of the cells with getters (other than the one who called the setter) get re-ran. This is problematic for two reasons:mo.state, there is no dependency from the setters to the gettersapp.embed(), setting amo.stateno longer causes an update to all of the cells with getters.Because of these problems
mo.statehas very limited use. You cannot rely on the setter to update the getters and you cannot rely on the setter to not update the getters. It cannot be used to get rid of dependency cycles in the DAG because if the setter updates the getters then the cycle still exists, it's just that instead of Marimo catching the cycle and erroring you get an infinitely looping notebook. You also cannot usemo.stateto control python code from widgets because the mechanism breaks when the notebook gets embedded.Due to the existence of traitlets for the latter use, I propose we make
mo.statehandle the former use. This change will not only makemo.statemore useful and consistent in behavior, but also make its semantics properly reflected by the DAG.Beta Was this translation helpful? Give feedback.
All reactions