Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Conversation

@DAreRodz
Copy link
Collaborator

@DAreRodz DAreRodz commented Feb 19, 2025

What?

Prevents an empty page when revisiting the initial page with full-site, client-side navigation enabled.

Required for the release of a proof of concept WooCommerce store that features full-page client-side navigation.

Why?

To fix this issue (pointed out by @SantosGuillamot).

The issue is that @wordpress/interactivity-router consumes the initialVdom private prop exposed by @wordpress/interactivity synchronously while that property is set asynchronously.

That's not a problem when @wordpress/interactivity-router is dynamically imported, like in the region-based, client-side navigation.

However, for full-site, client-side navigation, the @wordpress/interactivity-router module is enqueued from the beginning and executed before @wordpress/interactivity has finished executing the init function. This means that initialVdom is not available, leading to an empty body serialized for the initial page.

How?

This approach makes the init function to return a promise that is awaited before consuming the initialVdom prop from the router module.

Copy link
Collaborator

@SantosGuillamot SantosGuillamot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't say if the approach is correct, but applying await initDone in this other pull request seems to solve the reported problem.

Just to clarify, the bug does not exist in trunk or interactivity-api branches, but it is triggered by this other pull request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

type: bug The issue is a confirmed bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants