question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature: Efficient update adjacent nodes

See original GitHub issue

Great project. Love the DomDiff. One thing that I think may be improved is the updating of same-kind adjacent nodes. Right now, if I insert (for example) a new LI node at the beginning of a UL list, since the diff algorithm doesn’t has any context, it doesn’t knows that the list can be moved down instead of have to update every single LI element AND adding a new LI at the end.

On a library I’m working on (not related) I faced the same problem with objects, where I could not equate them using ==, so I had to resort to some identifier of the object (usually a property named id).

I think that maybe you can also use the same approach, by using a custom attribute/data attribute. What are your thoughts on this?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
cferdinandicommented, Feb 4, 2021

After the node is moved, it’s further diffed to check for any changes in attributes, content, sub-nodes and so on.

1reaction
cferdinandicommented, Feb 4, 2021

Alright, v8.1.0 should address this.

Under-the-hood, when comparing two DOM nodes, Reef now…

  1. Checks to see if the items are the same node type, and if so, if they have the same ID (if they both do not have an ID, that would be considered “having the same ID”).
  2. If they “are the same node” per the conditions above, their content and attributes are diffed as normal (same way its always worked)
  3. If they’re a different node (different type or ID), Reef checks to see if the right node exists further in the DOM tree.
  4. If it does, Reef moves it to the correct spot
  5. If not, Reef injects a new DOM node
Read more comments on GitHub >

github_iconTop Results From Across the Web

Simple scalable graph neural networks | by Michael Bronstein
Arranging the d-dimensional node features into an n×d matrix X (here n ... transformations with feature diffusion across adjacent nodes.
Read more >
Learning and Updating Node Embedding on Dynamic ...
dreds of millions of nodes and edges, an efficient online updating method is needed to update network embedding in real-time.
Read more >
Finding adjacent nodes in a tree - c++ - Stack Overflow
Basically, you need to record in the nodes the traversal from the root to the node and manipulate this information to generate the...
Read more >
Simple scalable graph neural networks - Twitter Blog
In this post, we describe a graph neural network architecture (SIGN) that is of simple implementation and that works on very large graphs....
Read more >
A Relax-and-Fix Decomposition Strategy Based on Adjacent ...
This new strategy considers the characteristics of the PCARP and the decomposition of the model occurs by exploring in adjacencies in the associated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found