Open cefn opened 1 year ago
Currently to avoid an important class of bug, watch notifications propagate after the state-changing procedure has returned (notifications are queued in the event loop as below).
https://github.com/cefn/lauf/blob/67f47c4ba3e7672ac6e037b9b32b678b054c26e8/modules/store/src/core/watchable.ts#L11
Can we recommend a pattern where another reference needs to track state directly (and should be updated in write).
Related the microtask should perhaps not be inline in notify, since partitioned stores may end up with two event loop ticks for no reason.
https://github.com/cefn/lauf/blob/67f47c4ba3e7672ac6e037b9b32b678b054c26e8/modules/store/src/core/partition.ts#L31-L38
Currently to avoid an important class of bug, watch notifications propagate after the state-changing procedure has returned (notifications are queued in the event loop as below).
https://github.com/cefn/lauf/blob/67f47c4ba3e7672ac6e037b9b32b678b054c26e8/modules/store/src/core/watchable.ts#L11
Can we recommend a pattern where another reference needs to track state directly (and should be updated in write).
Related the microtask should perhaps not be inline in notify, since partitioned stores may end up with two event loop ticks for no reason.
https://github.com/cefn/lauf/blob/67f47c4ba3e7672ac6e037b9b32b678b054c26e8/modules/store/src/core/partition.ts#L31-L38