-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Tracking Issue: Full-page client-side navigation #60951
Comments
I've started implementing some new e2e tests for full-page client-side navigation in #63268 |
I'd like to understand a bit better what remains to be done to improve the handling of assets:
This should be a trivial 1 line change.
I was the person who reported the original issue, and this issue is still present. We might have to implement something like the suggested fix.
We can't use Preact to render the
This should be a trivial change. Additionally, we should only load the module scripts belonging to the new blocks on the page or other modules that have declared their compatibility with full-page client-side navigation (link). Are you aware of any other considerations for asset loading? cc @luisherranz @DAreRodz @cbravobernal |
I looked at https://github.com/hotwired/turbo to see how they handle assets, and it seems like they kinda side-step the problem by not prefetching the scripts and styles 😄. They merge the "old" Interestingly, they never Hotwired can prefetch an HTML page for an EDIT: This is effectively the same strategy for loading assets that @gziolo and I suggested here & here |
Nice! Maybe this is useful as well: a while ago, I did a quick experiment, using the htmx It also injects HTML tags and uses The htmx |
Pasting this @michalczaplinski's comment from this PR to have the conversation centralized 🙂
A few things:
|
Thanks Luis!
yup, that was my idea too 🙂 But as we're going to use modules then, for scripts, we only have to do the second thing that you mention which is this:
For CSS, I was considering something like what you suggested, but I'm also not yet 100% sure. I'll probably have to try it out in a prototype. |
Status Update#64067 has been merged, which fixes #63880. It improves the handling of JS assets when doing full-page client-side navigation and brings the following improvements:
Now, follow-up PRs should focus on:
|
Superseded by this, as this is going to be the focus for WP 6.8. Let's move the conversation there 🙂 |
What problem does this address?
Full-page, client-side navigation (for lack of a better name) is another navigation mode we want to include in the Interactivity API along with the current region-based, client-side navigation already implemented.
Region-based navigation works by updating the HTML of those regions defined on the current and target pages. When there are no matching regions between the two pages, navigation is delegated to the browser, and the page is reloaded. In such cases, the application's JS state is reset, and it is not possible to implement features such as keeping a video open or a song playing while navigating the page.
In contrast, full-page navigation updates the HTML of the entire page when navigating without the need to specify regions. This allows you to transition from one page to another on the site while maintaining the application's state. This is, in fact, what is implemented at https://wpmovies.dev/, although that implementation needs to be polished and improved before it can be published.
In that regard, @SantosGuillamot has created a PR with a first iteration under an experimental flag in #59707, although work remains to be done, especially in relation to the handling of new assets appearing on the target page, whether inside
<head>
or<body>
. This feature is also missing for region-based navigation.Current tasks
The following list of tasks is based on feedback received in #59707:
Explore how to modify the body tag without the hack: link.touchstart
in addition tomouseenter
on mobile devices for prefetching: link. (Maybe on click is enough)url
parameter and adapt the tests to reflect that: link.Explore deeper how to use event delegation in the client: link.touchstart
or changingmouseenter
event topointerenter
for prefetching: linkget_admin_url()
,wp_login_url()
) as opposed to hard-coding them: linkThe text was updated successfully, but these errors were encountered: