Fix whitespace-only implicit and explicit slots during folding - #209
Conversation
Benchmark Result: Default
Median of 10 attempts (* = outlier, excluded from result), 5000 iterations x 10 rounds, 47.23s total To run a specific benchmark, comment |
|
Thanks @ghabriel25! This looks good, however the same issue applies to any slot, not just the one created from loose content. Can we check for empty whitespace whenever we're creating a placeholder for a slot? |
|
@ganyicz Sure but its already 2AM here so I'll push it later. |
|
@ganyicz Let me know if it needs additional test 👌 |
75b8caa to
a8558cd
Compare
|
/benchmark slot |
Benchmark Result: Slot
Median of 10 attempts (* = outlier, excluded from result), 5000 iterations x 10 rounds, 14.04s total To run a specific benchmark, comment |
Remove comment about skipping whitespace-only explicit slots.
|
Thanks! |
Problem
When Blaze folds a component with whitespace-only content:
the whitespace was incorrectly treated as actual slot content. Blaze would create a default slot placeholder, causing the component to receive a non-empty
ComponentSlotduring rendering.This could cause components to behave differently when Blaze was enabled.
Changes
Foldable::setupSlots()now checks the actual rendered loose content before creating an implicit default slot.Whitespace-only content no longer creates a slot placeholder, while actual content continues to behave as before.
Result
ComponentSlotsemantics or normal non-Blaze rendering.Related PR: livewire/flux#2821
Fixes: livewire/flux#2816