Repository navigation
fix(columns): render the wire:key callers pass to columns and cards - #234
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clicking a column's add card button can light the loading spinner in a different column. It happens after any request that inserts, removes or reorders a column ahead of the clicked one: the spinner appears on the column now sitting where the clicked column used to be. Relaticle hit it by hiding its "No Stage" column, reloading, and showing it again. Clicking Add in the second column then spun the first column's
+.What changed
modern/index.blade.phpand the classicindex.blade.phppasswire:key="column-{id}"to each column, and the classic column passeswire:key="card-{id}"to each card. None of the three components printed$attributes, so the keys never reached the DOM.modern/livewire/column.blade.php,livewire/column.blade.phpandlivewire/card.blade.phpnow render{{ $attributes->class(...) }}on their root.configin@props. Its caller passes:config, and an undeclared array attribute would make$attributesthrow when rendered. Declaring it keeps any published column view that still passes it working.Why it broke
Without keys, Livewire's morph pairs columns by position. Livewire reads
wire:targetonce, when it initialises an element. The morph patched the attribute on the reused node, but the spinner stayed bound to the column the node first held. The request itself carried the clicked column, so cards still landed in the right column. Only the spinner was misplaced.Behavior to know about
No config key, no JS or CSS change, so
filament:assetsis not needed. The only DOM change is thewire:keyattribute on column and card roots, plus any other attribute a caller passes to these components.Tests
tests/Browser/ModernBoardTest.php: "the add card spinner stays in its own column after a column is inserted before it" showshidden_columnthroughshowAllColumns, holds the request and reads which column shows a spinner. Before the fix it reportshidden_columnandin_progress; after, onlyin_progress.tests/Modern/Feature/LivewireBoardTest.php: "keys every column and card so a morph never reuses another column" pins the column and card keys on the modern and the classic board. The classic case renders a card with:configpassed. Both cases fail on the 4.x views. The released classic tests undertests/Featurestay untouched forbin/classic-gate.sh.Checked
--browser safari).LivewireBoardTest, bothCollapseEmptyColumnsTest, bothCardActionUrlTest,CardLabelTest,DragBindingsTest,ColumnHeaderMenuTest): all pass. Pint clean.Not checked
PHPStan was not run on this branch. The change touches only Blade views and tests, and CI runs it.