Add option to disable Inertia Modal

See original GitHub issue

Hey, I try to implement Inertia into a very large application. In the beginning I can only replace some parts of the app, so I run into the problem that I can’t use <inertia-link /> there. It’s because whenever I link into a legacy part of the app, the link will be opened in a modal. Since this is cool for something like error pages, it would be great to have an option to change that behavior. What do you think?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
reininkcommented, May 21, 2019

So, early on in my Inertia development I tried to make it that when a non-Inertia response comes back from the XHR request, it would automatically display that as the current page, instead of in a modal. However, this was not possible to get working properly, especially when it came to history management, despite both @adamwathan and my best efforts. We seriously spent a ton of time on this…and our determination was that it couldn’t be done.

That said, Inertia can totally work in an app that has some Inertia pages, and some server-side rendered pages. If you have pages in your app that are not Inertia pages, simply make those visits using normal links, and not using <inertia-link>. If you are making an Inertia request, you must return an Inertia response.

1reaction
alexryallcommented, Aug 3, 2022

@jakedowns You can stick something along these lines in your app.js file, the preventDefault() will stop the modal opening and you can add whatever code you want before that.

Inertia.on('invalid', (event) => {
    alert('custom error handling')
    event.preventDefault()
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Inertia.js forms, modals, and SSR - Jonathan Reinink - YouTube
Inertia.js forms, modals, and SSR - Jonathan Reinink - Laracon Online Summer 2021Jobs in Laravelhttps://larajobs.
Read more >
Forms - Inertia.js
You can use the processing property to track if a form is currently being submitted. This can be helpful for preventing double form...
Read more >
Inertia, React and Laravel: Popup Modal Example - Medium
ModalWithButtons always shows a “Cancel” button, and you can pass extra buttons through the buttons property. The modals use the open property ...
Read more >
Inertia.JS , Laravel closing modal if no validation errors
this.$inertia.post is executed asynchronously, so this.openModal = false will most likely finish before you get a response from the server.
Read more >
Jetstream shows login modal when session expire's, how to ...
I use jetstream and when my session expires and I click a link with inertia, it open's a login modal. Where can I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found