inertiajs / inertia

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.
https://inertiajs.com
MIT License
6.36k stars 428 forks source link

Stuck on Deferred Loading State #2013

Open norjamille-kasan opened 3 days ago

norjamille-kasan commented 3 days ago

Version:

Describe the problem:

When clicking Link that redirect to the current page, the loading indicator for deferred props will show and the props will never show again. This is also the case when submitting a form using form helper and redirecting back to the page. Although it can be fix by putting only:['propName'] key to the form.

Steps to reproduce:

controller :

return Inertia::render('Owner/Group/Index',[
          'groups'=> Inertia::defer(fn() => Group::query()
            ->latest()
            ->paginate(15)->withQueryString()) 
]);

vue page :

<Deferred data="groups">
       <template #fallback>
               <div>Loading...</div>
       </template>
        <div v-for="(group, index) in groups.data" :key="group.id" class="hover:bg-accent cursor-pointer">

         </div>
</Deferred>

link tag:

 <Link href="/groups">
          <UsersIcon class="h-4 w-4 mr-2" />
           Groups
</Link>
MarcEspiard commented 2 days ago

Same issue on the react adapter

norjamille-kasan commented 2 days ago

@MarcEspiard I think you can put only={} props on your link tag. But base on the docs and what Taylor shows in the laracon I doubt this is the suppose behavior. but we'll see. it's still on beta :). still kudos to inertia team