Skip to content

Direct Modal URL visit does not open Modal in v3 #215

@drehimself

Description

@drehimself

Environment Details

  • PHP Version: 8.5.1
  • Laravel Version: 13.6.0
  • React or Vue Version: 3.5.13 Vue
  • Inertia.js Version: 3.0.0
  • Inertia Modal Version: 3.0.1

Bug Report

Description

After upgrading to v3, visiting a modal route URL directly no longer opens the modal. In v2 (and previous versions), this worked as expected.

Steps To Reproduce

Route::inertia('/', 'Welcome')->name('home');

Route::get('/modal-example', function () {
    return Inertia::modal('ModalExample')->baseRoute('home');
});
<ModalLink navigate href="/modal-example">Open Modal</ModalLink>

Works fine when the ModalLink is clicked. However, if you visit /modal-example directly (or hard refresh) in the location/URL bar, the modal does not show up.

👉 GitHub Repo Example: https://github.com/drehimself/inertia-modal-example

Repo includes a temp workaround (appWoarkaround.ts) that AI helped scaffold out.

Expected Behavior

The modal should pop up when the URL is visited directly (or refreshed).

Actual Behavior

The modal does not show up, and the URL is reset to the base route defined.

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