Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, server-rendering a Clearwater app involved generating the virtual DOM nodes and replacing what was rendered by the server. This is pretty inefficient, though, because it has to throw away all of the existing server-rendered nodes. Basically, the first Clearwater render was like Turbolinks, which isn't as fast as you might think.
This PR lets Clearwater handle the existing DOM nodes as if they were artifacts of a previous Clearwater render. The best thing about this is that Clearwater doesn't even have to be what rendered it on the server.
In order to accomplish this, I had to add another JS library. This required shaving at least 3 yaks to enable us to use NPM for all that, but it ends up making our JS assets (current and future) easier to manage. Unfortunately, it also means we're stuck using NPM.
Before this, updating the
virtual-dom
library was a mess: I included my own flavor of it (includes an important performance optimization not yet merged into the original) which was stored on one of my local machines, but not anywhere else. That made it impossible for anyone but me to update that library and even I couldn't do it if I was away from that machine. This PR streamlines that by using NPM andbrowserify
, pulling both of the required runtime dependencies from external sources. This means that Clearwater's canonicalvirtual-dom
library is now at clearwater-rb/virtual-dom.