Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Add SPA behavior for links #2

Open
blakeembrey opened this issue May 25, 2022 · 0 comments
Open

Add SPA behavior for links #2

blakeembrey opened this issue May 25, 2022 · 0 comments

Comments

@blakeembrey
Copy link
Member

blakeembrey commented May 25, 2022

Provide a link component that will make a request for the server-side props of the requested route, and pull in the related scripts + CSS. Transition the current page to the new one without causing a reload.

Should be simple, just add a header to existing GET and POST requests that returns PageData directly as JSON. Replace the context directly to cause a re-render. To support changing the script and CSS at the same time, need to import/inject both and wait until loaded, then render it instead of the initial application. Also remove the original CSS/script from the page. When clicking the link it should change the URL first, and then load, since that seems to most closely mimic browser behavior.

It's also worth figuring out if there's a way to get the page to appear as if it's loading. An iframe might work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant