For the longest time sails.inertia.render felt like a hack but it was the only way I thought possible at the time to get the req and res needed to implement the Inertia protocol.
Ideally I'd like for the Inertia implementation in Sails to embrace actions2 exits. This was the syntax I've dreamt about for a while
This implementation will solve #78 as well because the race condition will no longer exists as sails.inertia.render won't be implemented at all in the InertiaMiddleware
Deprecate sails.inertia.location and sails.inertia.render
These two methods will be deprecated in favour of using custom responses
inertia - Handles inertia requests
inertiaRedirect - Handles inertia redirects
The middleware will now be lightweight as it sets the shared props and flash messages.
Upgrading
For now you'd have to just copy the inertia and inertiaRedirect responses in api/responses/ of the mellow-vue template into your applications api/responses. In the future I think I'll provide a Sails generator that will expose sails generate response inertia and sails generate response inertiaRedirect so we can evolve these responses and you run a single command to get the updates if need be.
Description
For the longest time
sails.inertia.render
felt like a hack but it was the only way I thought possible at the time to get thereq
andres
needed to implement theInertia
protocol.Ideally I'd like for the Inertia implementation in Sails to embrace actions2 exits. This was the syntax I've dreamt about for a while
It confirms to how Sails return or throw responses.
This implementation will solve #78 as well because the race condition will no longer exists as
sails.inertia.render
won't be implemented at all in the InertiaMiddlewareDeprecate sails.inertia.location and sails.inertia.render
These two methods will be deprecated in favour of using custom responses
The middleware will now be lightweight as it sets the shared props and flash messages.
Upgrading
For now you'd have to just copy the inertia and inertiaRedirect responses in
api/responses/
of the mellow-vue template into your applicationsapi/responses
. In the future I think I'll provide a Sails generator that will exposesails generate response inertia
andsails generate response inertiaRedirect
so we can evolve these responses and you run a single command to get the updates if need be.Let me know your thoughts on this.