Skip to content

Inertia::defer and browser "back" #2465

@Aigarsss

Description

@Aigarsss

Inertia adapter(s) affected

  • React
  • Vue 3
  • Svelte
  • Not Applicable

JS package version

"@inertiajs/react": "^2.0.14",

Backend stack (optional)

Laravel 11

Describe the problem

I am running into an issue, where if I use 'data' => Inertia::defer(fn() => $data), it gets lazy loaded fine. But if I then visit some other site, and click the browsers "back" button, the deffered data wont load.

It works if i use 'data' => Inertia::otpional(fn() => $data)

and

    useEffect(() => {
        router.reload(["data"]);
    }, []);

Is anyone else getting this and is this expected?

Steps to reproduce

  1. Pass data with defer 'data' => Inertia::defer(fn() => $data)
  2. Open page (loads fine)
  3. Open any other page, like google.com
  4. Press browser back, deferred props wont load

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions