o0101 / good.html

💎 Good.HTML. A nice framework without the bad stuff. Lots of custom elements, and nice templates. Good. HTML
https://o0101.github.io/good.html/
MIT License
21 stars 2 forks source link

[perf][correctness] consider re-adding idempotent state with equivalence checking for perf #18

Closed o0101 closed 3 years ago

o0101 commented 3 years ago

So rather than doing merging as we recently transitioned to do (in order to not indicate to every sub view that a new state object has been passed to them (a new state reference)), we make it so that we can pass new references (clones), but that we check equivalence (likely JSON === JSON) to avoid attempting a re-render when nothing changed.

I think I'm doing this already. Possibly, because I'm using JSON equiv checks (which only prevents equivalence being incorrect claimed, but still permits difference to be incorrectly claimed (when the keys have the same values but present in the JSON in different orders)) to determine whether to render or not because: 1) I do have minimal re-renders and 2) the only signal for that, since the state object references are the same (because we are merging not cloning), is the JSON equivalence.

So I think to implement this all I need to do is remove any logic where a reference difference implies a logical difference from the equivalence checks.