Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

butifarra's avatar

Livewire 3 project not working without deprecated @livewireStyles @livewireScripts old directives

Hi guys. I found something strange. I have a project with Laravel 3, that does not updates the input tag with the variable change. It works from the view to the component, but not the other way round. So, I did a project from scratch, for test purposes, with Laravel 11 and Livewire 3, and here comes the question. This new project didn't work, the updatedFoo event didn't fire. So, after 6 hours of trying, I added @livewireStyles @livewireScripts and it started working! Why, if they are not required in Livewire 3 anymore? Livewire version: 3.4.10.

Composer:
{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The skeleton application for the Laravel framework.",
    "keywords": ["laravel", "framework"],
    "license": "MIT",
    "require": {
        "php": "^8.2",
        "laravel/framework": "^11.0",
        "laravel/tinker": "^2.9",
        "livewire/livewire": "^3.4"
    },
    "require-dev": {
        "fakerphp/faker": "^1.23",
        "laravel/pint": "^1.13",
        "laravel/sail": "^1.26",
        "mockery/mockery": "^1.6",
        "nunomaduro/collision": "^8.0",
        "phpunit/phpunit": "^11.0",
        "spatie/laravel-ignition": "^2.4"
    },
    "autoload": {
        "psr-4": {
            "App\": "app/",
            "Database\Factories\": "database/factories/",
            "Database\Seeders\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi",
            "@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
            "@php artisan migrate --graceful --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true,
            "php-http/discovery": true
        }
    },
    "minimum-stability": "stable",
    "prefer-stable": true
}

THE BLADE VIEW (if I remove Styles and Scripts, it DOES NOT work, no updating, no lifecycle, no connection).

@livewireStyles
@livewire('prueba')
@livewireScripts

THE LIVEWIRE COMPONENT

<?php

namespace App\Livewire;

use Livewire\Component;

class Prueba extends Component
{
    public $name, $description;

    public function updatedName($value) //IT DOES NOT WORK WITHOUT @LIVEWIRESCRIPT-STYLE
    {
        $this->description = $value;
    }

    public function render()
    {
        return view('livewire.prueba');
    }
}

About that original (real) project, which only works one way, any ideas? This new project, with the directives, works both ways, the input is indeed updated when I update $name in the component. In my real project, the new value of the variable reaches the view (I use Xdebug), but the new value is not shown. I must say that in my real project I do NOT have the old directives, and the updatedFoo() method does work, to add more confusion.

0 likes
2 replies
Snapey's avatar

Please edit your question, marking code blocks

Please or to participate in this conversation.