Hey all π I'm thinking what is the best approach to model table machine(s). Think of a table that is similar to the notion table, ie has the following features.
- each column has a pre-determined type
- column type can be changed
- each cell is editable but the logic depends on the on the column type.
- both column and rows can be dragged for re-orders
- filtering, grouping, sorting...
My first approach was to put it all in one machine and that worked fine but then the machine kept getting bigger and more hard to manage.
After i learned about spawned machines I thought this might be a good fit, so I tried to spawn a columnMachine and a cell Machine for each column and cell and connect them to the table machine. However this approach had issues with re-renering the table machines. as it turned out invoked actors changes don't trigger re-renders for parent machine.
This was a problem as now when column type changes the cell don't react to that change, see code below.
The third approach is maybe what I called a switchboard where columns send events to parent, parent send events to cells, but not sure if this the best approach.
I guess my question is what the "xstate" way to build such a table?