-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When Blaze is enabled, a slot declared inside an @if statement is rendered even when the condition evaluates to false.
The condition appears to be ignored and the slot content is always displayed.
Component causing the issue
Component (authentication-card.blade.php, simplified):
@blaze
<div>
@isset($header)
{{ $header }}
@endisset
{{ $slot }}
</div>Usage:
<x-guest-layout>
<x-authentication-card>
@if (session('teamInvitation'))
<x-slot name="header">
[SOME CONTENT]
</x-slot>
@endif
[...]
</x-authentication-card>
</x-guest-layout>The header slot should only be rendered when the @if condition evaluates to true.
Expected behavior
The slot should be displayed conditionally when wrapped in an @if statement.
Actual behavior
The slot is always displayed, regardless of the @if statement.
Notes:
- Disabling Blaze restores the expected behavior.
- Moving the @if statement inside
<x-slot name="header">fixes the issue:
<x-slot name="header">
@if (session('teamInvitation'))
[SOME CONTENT]
@endif
</x-slot>but I have not found any explanation or justification why my original version shouldn't work.
- The issue does not appear to be related to the specific condition. For example, the same behavior occurs with
@if (random_int(1, 1000) === 777)
Environment
- Laravel version: 12.53.0
- PHP version: 8.3
- Blaze version: 1.0.4
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working