inertiajs / inertia-rails

The Rails adapter for Inertia.js.
https://inertia-rails.dev/
MIT License
574 stars 45 forks source link

Add redirect_back w/ inertia errors support #56

Closed christoomey closed 3 years ago

christoomey commented 3 years ago

This builds on the work in 40f36a5580a3362ed2e9dbd23373b61e82dfc98d which added an inertia-aware wrapper around redirect_to.

This change implements the same inertia errors handling for redirect_back, which I've found to be particularly useful when working with Inertia, especially with error handling.


Note: I, unfortunately, wasn't able to get the specs running locally (see notes in https://github.com/inertiajs/inertia-rails/issues/55).

Also, I noticed that this behavior is currently undocumented on the inertia site, and I only discovered this feature by reading through recent PRs. I'd be happy to add to the documentation, assuming that's something that would of interest.

christoomey commented 3 years ago

No hurry on my end (and nice to connect as well 👋). I implemented this directly in my own codebase, but felt like it was worth upstreaming, so wanted to share here.

BrandonShar commented 3 years ago

For sure. And for your other question, yes rails docs contributions are always welcome on https://github.com/inertiajs/inertiajs.com . We have a bad habit of occasionally batch adding things instead of as they release 😄 .

christoomey commented 3 years ago

Hey @BrandonShar, happy new year 👋 Wanted to check back in and see if this was still in consideration.

BrandonShar commented 3 years ago

gah, sorry; totally slipped my mind!

BrandonShar commented 3 years ago

@christoomey just tagged 1.9.0, let me know if anything seems amiss.

And thanks for the bump!

christoomey commented 3 years ago

Awesome, thanks!