Comments (4)
Hi Mikita, as discussed earlier let's treat this as a potential enhancement. As discussed here, mutation detection happens by assignment and List
is no exception.
from streamsync.
@mmikita95 I think this one has been delivered in 0.4.0. Could you confirm ?
from streamsync.
@raaymax wants to fix this :)
from streamsync.
@FabienArcellier sadly, can't confirm. Good news is that the state keeps this change – I think I remember that it was not the case, but the change still doesn't get propagated to the frontend instantly – it has to "wait" on another, "trackable" change.
This is the setup I used to test if you're interested:
main.py
import streamsync as ss
def implicit_list_modification(state):
state["list_to_be_modified"].append("test")
def explicit_list_modification(state):
state["list_to_be_modified"] += ["test"]
initial_state = ss.init_state({"list_to_be_modified": []})
ui.json
{
"metadata": {
"streamsync_version": "0.4.0"
},
"components": {
"root": {
"id": "root",
"type": "root",
"content": {
"appName": "List modification test"
},
"isCodeManaged": false,
"position": 0
},
"main-page": {
"id": "main-page",
"type": "page",
"content": {
"pageMode": "",
"key": "main"
},
"isCodeManaged": false,
"position": 0,
"parentId": "root"
},
"d2w3obvhbri2sbut": {
"id": "d2w3obvhbri2sbut",
"type": "columns",
"content": {},
"isCodeManaged": false,
"position": 0,
"parentId": "f2qst53hgdfydwyw",
"handlers": {},
"visible": true
},
"437w7haqfmf98fx7": {
"id": "437w7haqfmf98fx7",
"type": "column",
"content": {
"width": "1"
},
"isCodeManaged": false,
"position": 0,
"parentId": "d2w3obvhbri2sbut",
"handlers": {},
"visible": true
},
"3qqlvgpygldtm3zu": {
"id": "3qqlvgpygldtm3zu",
"type": "column",
"content": {
"width": "1"
},
"isCodeManaged": false,
"position": 1,
"parentId": "d2w3obvhbri2sbut",
"handlers": {},
"visible": true
},
"f2kq09lfygpmx8ot": {
"id": "f2kq09lfygpmx8ot",
"type": "button",
"content": {
"text": "Test implicit list modification"
},
"isCodeManaged": false,
"position": 0,
"parentId": "437w7haqfmf98fx7",
"handlers": {
"ss-click": "implicit_list_modification"
},
"visible": true
},
"pz9w7yngw9o4iqxz": {
"id": "pz9w7yngw9o4iqxz",
"type": "text",
"content": {
"text": "@{list_to_be_modified}"
},
"isCodeManaged": false,
"position": 0,
"parentId": "3qqlvgpygldtm3zu",
"handlers": {},
"visible": true
},
"uzp2y2hlnsfyck32": {
"id": "uzp2y2hlnsfyck32",
"type": "button",
"content": {
"text": "Test explicit list modification"
},
"isCodeManaged": false,
"position": 1,
"parentId": "437w7haqfmf98fx7",
"handlers": {
"ss-click": "explicit_list_modification"
},
"visible": true
},
"f2qst53hgdfydwyw": {
"id": "f2qst53hgdfydwyw",
"type": "section",
"content": {
"title": ""
},
"isCodeManaged": false,
"position": 0,
"parentId": "main-page",
"handlers": {},
"visible": true
}
}
}
Expected effect is that "test" appears in the list on button press for both cases – but, in fact, the "test"s appended by the click(s) of the first button only appear when the second, "explicit" button is pressed.
from streamsync.
Related Issues (20)
- import for State, for using State Schema, is missing in streamsync highlevel import
- "Dropdown Input" improvement
- Multi choice dropdopw choices in a section does not show all options and is cutoff HOT 3
- Not all components follow the Horizontal stack edict HOT 1
- Repeater context returns a wrong value
- exclude generated files as storybook and app_templates from repository
- Horizontal stack missing align-items setting HOT 1
- initial position of Switch Input doesn't match bound value (if True) HOT 1
- Feature Request: Modal Window component
- Custom Components not loading with .cjs extension HOT 2
- Feature request: Add search and keyboard shortcuts to toolkit
- It is possible to modify the state from js script?
- Question: How to clear the chat bot window? HOT 2
- Question: How do I pick up the URL variables at the start of the app? HOT 4
- Workaround for editable Dataframe
- Reuse component inside Repeater
- How to Package a StreamSync App into an Executable Using PyInstaller?
- Dropdown bug. can't select Bug HOT 3
- Dark mode for editor and app HOT 1
- Problem with StreamSyncState HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from streamsync.