swup / livewire-plugin

A swup plugin for integrating Laravel Livewire ♻️
https://swup.js.org/plugins/livewire-plugin
MIT License
5 stars 2 forks source link

Fixed: missing method on newer versions of livewire. Closes #2 #3

Closed james2doyle closed 3 months ago

james2doyle commented 3 months ago

Description

Screen Shot 2024-07-05 at 9 58 00 AM

Screen Shot 2024-07-05 at 9 59 59 AM

Seems like Livewire.restart() has been removed on newer versions of Livewire.

Some context: https://github.com/livewire/livewire/issues/2334#issuecomment-759901196

So the fix is to only call that function if it exists. Otherwise, we call the restart or refresh methods on the components themselves. Since there seems to be two different ways to restart components, each one is tried if it exists.

Checks

Tested with Livewire 3.4 and Swup 4.6.1.

Additional information

I think this can be tagged as 2.1.0 because it is backwards compatible with the previous version and only calls the new code if the old one is missing.

daun commented 3 months ago

Fine to merge from my end! I don't have a testing instance available, either, but the code looks sound and I'm assuming the changes are manually tested :)

james2doyle commented 3 months ago

I checked it locally with a patch first and then deployed the patch to test it. Unfortunately their was no information in the Livewire repo about what happened to the restart method

On Sat, Jul 6, 2024, 8:29 AM Philipp Daun @.***> wrote:

Fine to merge from my end! I don't have a testing instance available, either, but the code looks sound and I'm assuming the changes are manually tested :)

— Reply to this email directly, view it on GitHub https://github.com/swup/livewire-plugin/pull/3#issuecomment-2211797974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK37GEBTCPERYUFFPDC663ZLAEM3AVCNFSM6AAAAABKNZPPRSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJRG44TOOJXGQ . You are receiving this because you authored the thread.Message ID: @.***>

hirasso commented 3 months ago

@james2doyle your patch has been released in version 2.0.1. Thank you for contributing! 👏

james2doyle commented 3 months ago

Great! Thanks for the speedy attention!

On Sat, Jul 6, 2024, 11:48 a.m. Rasso Hilber @.***> wrote:

@james2doyle https://github.com/james2doyle your patch has been released in version 2.0.1 https://github.com/swup/livewire-plugin/releases/tag/2.0.1

— Reply to this email directly, view it on GitHub https://github.com/swup/livewire-plugin/pull/3#issuecomment-2211853829, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK37GAFCFCP3TOZAG4VKE3ZLA3WBAVCNFSM6AAAAABKNZPPRSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJRHA2TGOBSHE . You are receiving this because you were mentioned.Message ID: @.***>

james2doyle commented 3 months ago

Just tested this release (2.0.1) live on the site I'm developing, and it works perfectly!