Skip to content

Content Collection Data Not Updating After Browser Back Navigation #14610

@smn-cds

Description

@smn-cds

Astro Info

Astro                    v5.15.0
Vite                     v6.4.1
Node                     v22.14.0
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When editing a content collection file during development, changes are not reflected automatically after using the browser’s Back button.
If a content value is modified while the user is on a page that doesn’t use that data, navigating back to a page that does use it still shows the old value.
The update only appears after a full browser refresh or using a link to this page.

Example Project

A minimal reproduction (see link below) includes two pages:

  • Index.astro
    • Displays a value from a content collection
    • Includes a link to /other
  • Other.astro
    • Does not use the content collection
    • Includes a link back to /

Steps to Reproduce

  1. This cannot be reproduced on stackblitz. Clone the github repository to reproduce the issue.
  2. Start the dev server: npm run dev
  3. Open http://localhost:4321/
  4. Click “Link to other site” to navigate to /other
  5. In the project, edit: ./src/counter/abc.json. Change "counter" from 0 to 43.
  6. Use browser back navigation (not the link labeled "Back") to return to /

Actual Result

The counter value remains 0 (the old value).
The page does not refresh automatically to reflect the change.

What's the expected result?

When navigating back, the page should detect that content collection data has changed and automatically refresh to show the new value (43) — without requiring a manual reload.

Notes

  • The automatic refresh works correctly when navigating via internal links (for example, using the “Back” link on the /other page).
  • The issue only occurs when using the browser’s native back navigation after editing a content collection file.

Link to Minimal Reproducible Example

https://github.com/smn-cds/reproduce-content-collection-update

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in reviewHas been triaged but not yet decided if it is a bug or not.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions