Skip to content

Interactivity Router does not update content with back/forward after reload #70500

@wongjn

Description

@wongjn

Description

The Interactivity client-side router does not update content when using the back/forward browser navigations after reloading a page that has been navigated to via client-side routing. The URL changes, the scroll position is restored, but the content remains the same. I'd expect either the client-side router to not activate or the content to be updated to show the correct content for the URL.

Step-by-step reproduction instructions

Via WordPress Playground, using core/query enhanced pagination:

  1. Open this blueprint
  2. On the homepage, click the next page pagination link a couple of times.
  3. Right click → Reload frame (or equivalent).
  4. Right click → Back (or equivalent).
  5. Notice how the list of blog posts has not updated.

Via a normal installation:

  1. Generate many posts, i.e. wp post generate.
  2. Create/edit a template to display posts with pagination via the core/query block. Ensure Full page reload is off.
  3. Go to the page that uses said template.
  4. Click the next page pagination link a couple of times.
  5. Reload the page.
  6. Hit the back browser button.
  7. Notice how the list of blog posts has not updated.

Screenshots, screen recording, code snippet

Template code for TwentyTwenty-Five
<!-- wp:template-part {"slug":"header","theme":"twentytwentyfive"} /-->

<!-- wp:group {"tagName":"main","style":{"spacing":{"margin":{"top":"var:preset|spacing|60"}}},"layout":{"type":"constrained"}} -->
<main class="wp-block-group" style="margin-top:var(--wp--preset--spacing--60)"><!-- wp:heading {"textAlign":"left","level":1} -->
<h1 class="wp-block-heading has-text-align-left">Blog</h1>
<!-- /wp:heading -->

<!-- wp:query {"queryId":0,"query":{"perPage":10,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false,"taxQuery":null,"parents":[]},"enhancedPagination":true,"align":"full","layout":{"type":"constrained","justifyContent":"center"}} -->
<div class="wp-block-query alignfull"><!-- wp:post-template {"align":"full","layout":{"type":"grid","columnCount":3}} -->
<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var:preset|spacing|60","bottom":"var:preset|spacing|60"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull" style="padding-top:var(--wp--preset--spacing--60);padding-bottom:var(--wp--preset--spacing--60)"><!-- wp:post-title {"isLink":true,"fontSize":"x-large"} /-->

<!-- wp:post-date {"isLink":true,"style":{"spacing":{"margin":{"top":"var:preset|spacing|40"}}},"fontSize":"small"} /--></div>
<!-- /wp:group -->
<!-- /wp:post-template -->

<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|60","bottom":"var:preset|spacing|60"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group" style="padding-top:var(--wp--preset--spacing--60);padding-bottom:var(--wp--preset--spacing--60)"><!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p>Sorry, but nothing was found. Please try a search with different keywords.</p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results --></div>
<!-- /wp:group -->

<!-- wp:group {"align":"wide","layout":{"type":"constrained"}} -->
<div class="wp-block-group alignwide"><!-- wp:query-pagination {"paginationArrow":"arrow","align":"wide","layout":{"type":"flex","justifyContent":"space-between"}} -->
<!-- wp:query-pagination-previous /-->

<!-- wp:query-pagination-numbers /-->

<!-- wp:query-pagination-next /-->
<!-- /wp:query-pagination --></div>
<!-- /wp:group --></div>
<!-- /wp:query --></main>
<!-- /wp:group -->

<!-- wp:template-part {"slug":"footer","theme":"twentytwentyfive"} /-->

Environment info

  • WordPress 6.8.1
  • Chrome 137.0.7151.120, Firefox 139.0.4
  • Windows 11

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

Labels

[Feature] Interactivity APIAPI to add frontend interactivity to blocks.[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions