neomjs / neo

The application worker driven frontend framework
https://neomjs.com
MIT License
2.83k stars 151 forks source link

vdom.Helper: add support for a boolean static vdom / vnode property #5559

Closed tobiu closed 1 month ago

tobiu commented 1 month ago

simply put: flag a node / sub-tree as static to exclude it from createDeltas() calls.

tobiu commented 1 month ago
Screenshot 2024-07-12 at 11 29 07

Screenshot 2024-07-12 at 11 29 50

"real world" test (of course not pushed) => changing the vdom of a button:

{tag: 'button', type: 'button', cn: [
    {tag: 'span', cls: ['neo-button-glyph']},
    {tag: 'span', cls: ['neo-button-text'], static: true},
    {cls: ['neo-button-badge']},
    {cls: ['neo-button-ripple-wrapper'], cn: [
        {cls: ['neo-button-ripple']}
    ]}
]}

Screenshot 2024-07-12 at 11 26 03

renders correctly, but can no longer get changed => excluded from delta updates.

<span class="neo-button-text" id="neo-vnode-2">Hello World</span>

=> the DOM will not get the static "attribute".