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.

Possibility to calculate diff without applying the changes (patching) to the dom

See original GitHub issue

I would like to calculate the diff between two trees, without patching, because it will be done in a webworker (without access to the DOM).

Similarly to what is done here: https://github.com/Matt-Esch/virtual-dom

var patches = diff(tree, newTree);
rootNode = patch(rootNode, patches);

Can this be done in this vdom implementation?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
leeoniyacommented, Dec 1, 2017

@cjh9 i randomly stumbled upon this [1] today, which sounds like exactly what you’re asking for.

[1] https://github.com/Gozala/dominion

2reactions
leeoniyacommented, Nov 27, 2017

I haven’t calculated the actual number.

open devtools and run document.querySelectorAll("*").length

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way in React to update a DOM witout constructing ...
Is there a way in React to skip this creation of Virtual Tree and calculate diff? Like the following: shouldComponentUpdate will return false...
Read more >
Reconciliation - React
When building up a new tree, new DOM nodes are inserted into the DOM. Component instances receive UNSAFE_componentWillMount() and then componentDidMount() . Any ......
Read more >
Delta Compression: A practical guide to diff algorithms and ...
Discover how diff algorithms can be used to support your diff/delta/patch functionality, and how they are used in developer tools such as Git....
Read more >
Making the Virtual DOM. Faster. - Aiden Bai
The patch function takes an existing DOM node, old virtual node, and new virtual node. The implementation is as follows: Calculate the difference...
Read more >
Building a Simple Virtual DOM from Scratch
Imagine we have a function diff (oldVTree, newVTree) which calculate the differences between the two virtual trees; return a patch function ...
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