Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production mode #15

Closed
cmizzi opened this issue Apr 26, 2019 · 4 comments
Closed

Production mode #15

cmizzi opened this issue Apr 26, 2019 · 4 comments

Comments

@cmizzi
Copy link
Contributor

cmizzi commented Apr 26, 2019

There's no production mode. To make it, we can't show error response into a modal. But, I don't really know if Laravel has to handle this case, or if Inertia should.

When an error occurred during navigation (using X-Inertia header), the modal is shown containing the error content (debug purpose), but never touches the vue component. I don't know how to manage the case. What a production mode need ? Not only the dev console to store the exception, but also a client feedback. I really don't know if this job should be done by Laravel, Inertia or various wrappers (inertia-vue, etc.).

A Laravel response will simply validate the error URL by loading an error component on it, I don't think it's the best way to manage that because if we want create a modal, we can't. Inertia cannot really do that, because it doesn't interact with the client directly but through the wrapper, but the wrapper cannot do the job because it is never informed about an axios error.

P.S: Sorry if the issue is confused, my head is about this thing 😄

@cmizzi
Copy link
Contributor Author

cmizzi commented Apr 26, 2019

I think it's related with #13, probably.

@cmizzi
Copy link
Contributor Author

cmizzi commented Apr 26, 2019

I have in mind this simple case, customizable by the user (modal or not, etc.).

Frame (1)

@cmizzi
Copy link
Contributor Author

cmizzi commented Apr 26, 2019

To do that, the user should be able to detect the error in the layout component (for example), and load an "error" component. But, the client side has to be able to detect this error.

@reinink
Copy link
Member

reinink commented May 8, 2019

Hey @cmizzi!

Are you suggesting that Inertia shouldn't show modals for errors in production? I think that's really up to the developer, and not something this adapter has to worry about.

That way I'd personally handle this is by updating my Laravel exception handler to return a proper Inertia response in the event of a server-side error. Doing that you can avoid showing the modal. I've actually tested this, and created an Error.vue page component, and it worked great. You could even do an environment check in your exception handler, and only show that page component in production.

No matter what, I think it's important that Inertia does something logical when it receives a non-Inertia response. For example, that could be caused by something entirely outside of Laravel. For example, maybe your DNS service or hosting provider shows some type of error page before it even hits your app. The modal is a great solution in those situations.

@reinink reinink closed this as completed May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants