-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Will need to extend Actor: https://github.com/statelyai/xstate/blob/b730b298994aa00e0a76783d747c8063853d389e/packages/core/src/createActor.ts#L64
and not use createActor just instantiates the default Actor.
However, the whole snapshot is replaced here: https://github.com/statelyai/xstate/blob/b730b298994aa00e0a76783d747c8063853d389e/packages/core/src/createActor.ts#L241
so that means we need to intercept that and deeply diff the values before assigning.
(VDOM, but it JS 🙃)
getSnapshot() just returns the _snapshot (which we need to intercept): https://github.com/statelyai/xstate/blob/b730b298994aa00e0a76783d747c8063853d389e/packages/core/src/createActor.ts#L747
So, if we override the update method, and then have our own snapshot property, and yield that out to consumers, then we get very targeted DOM updates without re-rendering.