rompetomp / inertia-bundle

Inertia.js server-side adapter for Symfony
MIT License
152 stars 37 forks source link

Add support for partial reloads #1

Closed rompetomp closed 5 years ago

rompetomp commented 5 years ago

See inertiajs/inertia-laravel#50

Problem here is: I'm not sure how to handle the laravel method App::call in Symfony.

Somehow, I need to autowire the Closure but I haven't found if it's actually possible.

reinink commented 5 years ago

You don't need to use App::call() (the container) when evaluating the lazy callbacks. I did this in the Laravel adapter since it allows you to inject stuff from the container into the closure, but it's not a specific requirement of Inertia.

reinink commented 5 years ago

Also, I decided on using two headers for partial reloads:

X-Inertia-Partial-Component: Users/Index
X-Inertia-Partial-Data: users,other

Inertia is including the component name in a header so that we can ensure server-side that we're only doing a partial loads when visiting the same component.

You can see how I implemented this in the Laravel adapter here.

rompetomp commented 5 years ago

I will implement the other header later today

Thanks for the assistance and input @reinink