DEV Community

Discussion on: HTML-first, JavaScript last: the secret to web speed!

Collapse
oz profile image
Evgenii OZ

By observables I mean functions. I’ve re-read the post but still can’t find how they can be serialized. Please don't take it as criticism, I’m just trying to get the idea.

Right now I prefer to keep the state inside the rxjs observables, and if Qwik wants to “imprint” every state change into HTML, then all of these functions should be somehow serialized - I have no idea how to do this, but I admit that I don't know every trick existing.

Maybe Qwik is not going to save absolutely everything, maybe it should be the only amount of data, needed to “resurrect” the app from HTML attributes. Or maybe Qwik is not going to save the state on every change.

In the first case, it raises the question, how it will affect the performance if we are going to save-restore the state on every user action (or app internal event).

In the second case, the framework should be extremely smart to determine what state is important and what can be ignored. Or it should be controlled by the programmer.

Thread Thread
mhevery profile image
Miško Hevery Author

Those are all excellent questions but explanation would require more text than a response here. Will follow up with more blog posts where we will explore this. The short answer is that the framework keeps caches to make this fast, but caches are done in a way so that loosing them is not an issue for functionality, just performance.