Skip to content

Seeking guidance on skipping specific nodes when diffing and applying diffs #131

Open
@panphora

Description

@panphora

I am working on a project where I use diffDOM to update the DOM based on state changes. I have encountered a situation where oldDom and newDom can have completely different sets of initial child nodes, and I need to selectively ignore diffs for a variable number of these initial children when creating and applying diffs.

My main challenge is that the number of children to be ignored is not constant and cannot be determined upfront. This variability makes it difficult to use a static filtering approach.

Here is an example scenario:

  • oldDom has a list of child nodes, some of which have been dynamically added or removed when the next state is generated
  • newDom reflects another state of the same page, with its own set of potentially new child nodes that should be compared to oldDom
  • I need to compare oldDom and newDom and generate diffs for all nodes except the initial children that differ in a way that's unpredictable

I'm seeking advice or a possible feature that could assist in the following:

  1. Ignoring diffs generated for a subset of child nodes without a pre-known fixed index (the child nodes to be skipped have specific classes)
  2. Applying diffs to oldDom while skipping over the aforementioned nodes to reflect changes in newDom correctly (the child nodes to be skipped have specific classes)

Could you please provide some guidance or recommend an approach to achieve this with diffDOM? Any help or pointers towards relevant parts of the documentation would be greatly appreciated.

Thank you for your time and for maintaining this useful library.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions