Skip to content

Dynamic component slot content not rendered when blaze disabled #170

@ghabriel25

Description

@ghabriel25

Describe the bug

I have this weird bug that only occured when I disabled blaze

BLAZE_ENABLED=false

The dynamic component slot's content not rendered at all. To simplify the issue, here is some screenshot of the slot layout

Blaze enabled

Image

Blaze disabled

Image

Component causing the issue

components

  • notification
    • section
      • index.blade.php
    • unread.blade.php

livewire

  • notification-section
    • unread
      • unread.blade.php
      • unread.php

pages

  • notifications
    • notifications.blade.php
    • notifications.php
// page component $current = 'notification-section.unread';
<div>
    <livewire:dynamic-component :is="$current" :wire:key="$current">
        // global filter slot
    </livewire:dynamic-component>
</div>
// livewire.notification-section.unread.unread.blade.php
<x-notification.section>
    <x-slot name="filter">
        {{ $slot }} // global filter slot goes here
    </x-slot>

    <x-slot name="markButtons">
        // button slot for unread notification
    </x-slot>
</x-notification-section>
// components.notification.section.index.blade.php
@blaze(fold: true, unsafe: ['markButtons', 'filter'])

<div>
    // some default content for all types of notification

    @if ($markButtons->isNotEmpty()) 
        {{ $markButtons }} // button slot for each type of notification goes here
    @endif

    @if ($filter->isNotEmpty())
        {{ $filter }} // global filter slot goes here
    @endif

    @foreach ($this->notifications as $notification)
        <div wire:key="notification-{{ $notification->id }}">
            <x-notification :mention="$notification->mention" 
                            :notification="$notification"
                            :user="$notification->user" />
        </div>
    @endforeach
</div>
// components.notification.index.blade.php
@blaze(fold: true)

@props([
    'user' => null,
    'mention' => null,
    'notification' => null,
])

@php
    $icon = $notification->read() ? 'envelope-open' : 'envelope';
@endphp

<x-dynamic-component {{ $attributes }} 
                     :icon="$icon" 
                     component="notification.{{ $notification->read() ? 'read' : 'unread' }}">

    <x-slot name="heading">
        // heading goes here
    </x-slot>

    <x-slot name="content">
        // content goes here
    </x-slot>

</x-dynamic-component>
// components.notification.unread.blade.php
@blaze(fold: true, memo: true, safe: ['heading', 'content', 'links'])

@aware([
    'notification' => null,
])

@props([
    'icon' => 'envelope',
])

<flux:callout :icon="$icon" inline>
    <div class="flex flex-col gap-4">

        <flux:callout.heading :icon="$icon" class:icon="sm:hidden">
            {{ $heading }} // not rendered when blaze disabled
        </flux:callout.heading>

        {{ $content }} // not rendered when blaze disabled

    </div>
</flux:callout>

Expected behavior

I expect it rendered properly either Blaze is enabled or disabled

Actual behavior

It only rendered when Blaze is enabled.

Environment

  • Laravel version: ^13.0
  • PHP version: 8.4
  • Blaze version: ^1.0

Additional context

What I have tried:

  • php artisan view:clear
  • php artisan:optimize:clear
  • composer remove livewire/blaze

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions