livewire / livewire

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
MIT License
22.19k stars 1.53k forks source link

Livewire v2b02e94e @push() @once() not working #1423

Closed tanthammar closed 4 years ago

tanthammar commented 4 years ago

I apologize if it is incorrect to post an issue about a version that is not released yet!

Description

Steps to reproduce

Context

|--base.blade.php @yield('body'), <head>@stack('styles')</head>
   |--app.blade.php @extends('layouts.base'), @section('body'), @yield('content'), {{ $slot ?? null }}
      |--livewire/blank-component.blade.php
         |--<x-pages.default /> livewire code </x-pages.default>

layouts/base.blade.php

    <head>
        <!-- Styles -->
        <link rel="stylesheet" href="{{ url(mix('css/app.css')) }}">
        @livewireStyles
        @stack('styles')
    </head>

livewire/blank-component.blade.php

<x-pages.default title="Testing livewire 2">
    <div class="px-6 sm:px-0">
        {{ $hello }}
    </div>
</x-pages.default>

components/pages/default.blade.php

@once('styles')
    <style>
        <!--some classes !-->
    </style>
@endonce
<div class="parent grid">
    <header><h1>{{ $title ?? 'No Title' }}</h1></header>
    <main>
        {{ $slot }}
    </main>
    <footer>Footer</footer>
</div>

The styles are not placed in the head they are injected into the livewire parent div

image

calebporzio commented 4 years ago

Thanks Tina,

Good call. I just pushed the fixes for these to master. Re-open if problem persists.

tanthammar commented 4 years ago

reopening: #1455

joydeep-bhowmik commented 1 year ago

Same problem in new liveiwire 3