Skip to content

Fix aware propagation in slots#135

Merged
ganyicz merged 2 commits intomainfrom
filip/fix-aware
Mar 14, 2026
Merged

Fix aware propagation in slots#135
ganyicz merged 2 commits intomainfrom
filip/fix-aware

Conversation

@ganyicz
Copy link
Copy Markdown
Collaborator

@ganyicz ganyicz commented Mar 14, 2026

The scenario

A component with @aware inside a slot doesn't receive attributes from its parent:

<x-field type="number">
    <x-input-with-aware /> {{-- $type is null --}}
</x-field>

The problem

Component data for aware was only pushed after slots were rendered:

$output .= $this->slotCompiler->compile(...); // <-- render slots
$output .= '<?php $__blaze->pushData(...); ?>'; // <--- push data
$output .= '<?php ' . $functionName . '(...); ?>';

The solution

Push data before rendering slots:

$output .= '<?php $__blaze->pushData(...); ?>';  // <--- push data
$output .= $this->slotCompiler->compile(...); // <-- render slots
$output .= '<?php ' . $functionName . '(...); ?>';

@ganyicz ganyicz merged commit 89dfd35 into main Mar 14, 2026
4 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

Benchmark Results

Attempt Blade Blaze Improvement
#1 344.70ms 16.66ms 95.2%
#2 346.64ms 16.47ms 95.2%
#3 346.00ms 16.70ms 95.2%
#4 349.33ms 17.15ms 95.1%
#5 346.77ms 16.65ms 95.2%
#6 346.21ms 16.37ms 95.3%
#7 351.88ms 17.21ms 95.1%
#8 347.91ms 16.59ms 95.2%
#9 345.50ms 16.72ms 95.2%
#10 349.93ms 17.06ms 95.1%
Snapshot 349.86ms 16.89ms 95.2%
Result 346.71ms (~) 16.68ms (~) 95.2% (~)

Median of 10 attempts, 5000 iterations x 10 rounds, 45.85s total

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant