NullVoxPopuli / NullVoxPopuli/ember-statechart-component

Fix fine-grained reactivity and nested actor support

Open
#508 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
39
Forks
7
PR merge metrics
No merged PRs in 30d

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/core/src/createActor.ts, especially the Actor definition and the update and getSnapshot locations linked in the issue. Trace how snapshots are replaced and consumed, then determine how fine-grained reactivity and nested actor support should work. Done means targeted DOM updates occur without re-rendering the whole component and nested actors remain supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.