laravel-splade icon indicating copy to clipboard operation
laravel-splade copied to clipboard

Rehydrate on a modal seems to only refresh the background

Open J87NL opened this issue 1 year ago • 2 comments

  • Laravel Version: 10.7.1
  • PHP Version: 8.2.4
  • Splade JS Version (npm): 1.4.7
  • Splade PHP Version (composer): 1.4.7
  • Dev environment: Ubuntu 22.04 with Apache2

Description:

When using <x-splade-rehydrate ...> on/inside a modal the data on the modal doesn't refresh/rehydrate. You can see a little glitch when the refresh happens.

Steps To Reproduce Issue:

I have the following blade with a modal, on it are a FormBuilder form where you can add a reaction and a list of all previous reactions. When adding a reaction I want to emit an event trigger but for simplicity (because we haven't implemented this in FormBuilder yet) I used poll here. After a new reaction is added I expect the x-splade-rehydrate to reload the list of $reactions, which it does when you open the page directly/full page, but it only glitches when opening the same page when using a modal.

    <x-splade-modal>

        {{-- The config of this form has option: `->stay(true, 'restore')` --}}
        <x-splade-form :for="$reactionForm" />

        {{-- For simplicity I use poll here --}}
        <x-splade-rehydrate poll="5000">
        
            @foreach($reactions as $reaction)
                {{ $reaction->body }}
            @endforeach
        
        </x-splade-rehydrate>
        
    </x-splade-modal>

I open 2 browsers next to each other, one with the full page and one with the modal and add a new reaction. Rehydrate works flawless on the full page. Would there maybe be a fix for this?

J87NL avatar Apr 12 '23 17:04 J87NL