salesforce / lwc

⚡️ LWC - A Blazing Fast, Enterprise-Grade Web Components Foundation
https://lwc.dev
Other
1.63k stars 395 forks source link

Could "block virtual dom" benefit LWC? #3565

Open AllanOricil opened 1 year ago

AllanOricil commented 1 year ago

https://million.dev/blog/virtual-dom

AllanOricil commented 1 year ago

I forgot lwc uses shadow dom

nolanlawson commented 1 year ago

I have not looked deeply into MillionJS, but I think there are two optimizations here that LWC could take advantage of:

  1. Static analysis – we already do this (https://github.com/salesforce/lwc/pull/2781). See also Vue static hoisting and Marko static subtrees.
  2. Dirty checking – AFAICT this is a kind of fine-grained reactivity, i.e. diff the state and then only update subtrees that have changed, not the entire component. We could potentially do this with some kind of compile-time analysis.

In any case, this is worth looking into more deeply, so I'll leave this issue open for now. Thanks for opening!