-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Router implementation alternatives #12
Comments
Hi there @skipkayhil, I'm glad you're bringing the router up. Thank you for the contribution to the project by the way, it is really appreciated. I think 1 is the best way to go, since the whole point of hyperstatic (IMO) is to avoid 2. I'm also unsure of what you mean in your solution for 1. It seems you are describing another problem but I might be wrong. I've detailed some info on the problem below if it can help. I actually spent multiple hours in the last weeks trying to hack ways to get rid of the I'm going to try to clarify the reason it exists below: Basically, when the hyperapp app loads, no "pages" bundles are loaded at all (including the one for the current page). Only hyperapp and hyperstatic is loaded. The code that lives above the router is loaded as well (ex: header / footer), but the code for the page itself is not (since it's under the router). The Since the pages are pre-rendered, if we don't parse the existing dom into vdom (which would happen if we remove the block of code at line 30 in router), this is what would happen:
All of this would end up creating a flash of content on first page load, which is basically one of the most important problem hyperstatic tries to solve in the first place. Notice that this is only a problem on the first page load (or full page refresh). The Here the two solutions that I think would solve the problem, but that I have not found a way to implement yet.
I think 2 is the best option performance wise, and also implementation wise since it would be very little code, but it might also be not possible at all. Let me know what you think about all this!! Thanks again for your time investment in this! |
The current implementation of the router (depending on parsing the current DOM into virtual nodes) seems like not very good practice and is definitely not declarative. I have two potential alternatives that I would be willing to implement to resolve this.
For 1, I believe I have a solution where state of a new route will be held until that route has been loaded, and then it replaces the active route in state. This would allow the page to stay interactive until the new page has loaded. Clicking a different link before the page has loaded could result in the new page replacing the new route in state, or other Links could be locked until the route of the first link clicked has loaded.
Let me know if you have any suggestions or questions, and I can work to implement one of these solutions
The text was updated successfully, but these errors were encountered: