Skip to content

VNode reuse #32

@tmadden

Description

@tmadden

General Information

  • Bug
  • Improvement
  • Feature
  • Other

Depends on the answer to my question I suppose. ;-)

Description

Hi, awesome library! :-) I've been developing a declarative UI library, and hooking it up to asm-dom has enabled me to create live examples of it in the documentation:

https://tmadden.github.io/alia

I've been considering creating a production-grade interface to asm-dom, but I have a question about doing this properly... My own library provides the mechanics for tracking whether portions of the UI specification have changed since the last update. Ideally, when I know that an element hasn't changed, I'd like to reuse the VNode from before rather than recreating it with h(). However, it seems that asm-dom does some subtle things with VNodes during patching that make this complicated. I thought I had this working at one point, but then when I reordered my nodes within their parent container, things broke. (Some of the nodes had apparently overwritten others in the resulting UI.)

Do you have any guidance on this? Is it a supported use case? Are there rules one could follow to at least reuse some nodes safely?

Thanks!

Versions

  • asm-dom: 0.6.0
  • Browser: Chrome (Windows, some official release from this year)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions