expressive-mvc
expressive-mvc copied to clipboard
models within arrays
I'm trying to build a generic form library on top of @expressive/react
. I am imagining a form where some fields are added to the form dynamically, for example when somebody adds a list of guests. Imagine a "Add guest" button which appends a new input field that allows the user to enter that guests name.
To reproduce a simpler version of this, I created this playground which dynamically adds new counters: https://codesandbox.io/s/example-counter-forked-ttk3ir?file=/src/App.js
This video shows how the counters only update if I force an update on the parent model.
https://user-images.githubusercontent.com/1765075/233773524-9717a80d-bbfb-4479-884d-fbbc088b5e58.mp4
Since I am trying to build a generic form library, I am attempting to use models inside of models. But it seems like the individual counters are not updated unless the parent is forced to update.
Is using models within models supported today? Any ideas what I might be doing wrong?
Here is a more complete example of where I want to go, which struggles from the same issue.