Respect's avatar

why wire wire-elements/livewire-strict package not working in livewire v4

  • hello friends thanks for helping why wire wire-elements/livewire-strict package not working in livewire v4 and is there alternative
  • it's not throwing any exeption if try to update any property from client side (nothing happen like in v3)
https://github.com/wire-elements/livewire-strict

AppServiceProvider.php

<?php

namespace App\Providers;
use WireElements\LivewireStrict\LivewireStrict;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        LivewireStrict::lockProperties();
    }

    /**
     * Bootstrap any application services.
     */
   
}

0 likes
3 replies
imrandevbd's avatar

Livewire v4 changed how property hydration/updates work internally, and wire-elements/livewire-strict hasn’t been updated to hook into those changes. In v3 it relied on middleware/hooks that simply don’t fire the same way anymore in v4, so lockProperties() becomes a no-op.

Respect's avatar

oh thanks for answer , is there any alternative way ?

ghabriel25's avatar

@respect Looking at it's codebase, I think you should be able to create your own component hook which extends Livewire component hook especially update method and simply throw an exception if the property name that being updated was not locked.

Or you could post an issue there to support current Livewire 4

Please or to participate in this conversation.