Skip to content

Fix Livewire 4 morph for table partials with ignored rows - #4

Merged
luanfreitasdev merged 1 commit into
1.xfrom
fix/inline-table-partials
Aug 26, 2026
Merged

Fix Livewire 4 morph for table partials with ignored rows#4
luanfreitasdev merged 1 commit into
1.xfrom
fix/inline-table-partials

Conversation

@luanfreitasdev

Copy link
Copy Markdown
Member

Summary

Partials that skip the full Livewire HTML render failed to update tables when a tbody contained stateful rows (inline filters, Tom Select, wire:ignore). Search, sort, and pagination appeared to do nothing because the fragment morph ran outside Livewire 4's morph pipeline and could throw on the first fragment.

This showed up in PowerGrid Flux inline filter mode with POWERGRID_PARTIALS_ENABLED=true. The same flows worked with partials disabled (full re-render).

What changed

resources/js/partials.js

  • Apply fragments inside Livewire 4 onMorph (falls back to queueMicrotask if onMorph is missing).
  • Morph one fragment at a time; a failure no longer aborts the rest of the payload.
  • Skip wire:ignore / wire:ignore.self in addition to wire:partial.ignore.
  • Guard a missing morph target (wrapper.firstElementChild).
  • Use the parent tag (including custom elements) as the HTML wrapper so <tbody> / <thead> parse correctly.
  • Fire morph, morph.added, and morphed so newly inserted nodes pick up Livewire/Alpine.

Tests

  • Feature: tbody partial emits partialFragments (no html effect) and strips ignored filter-row content to PARTIAL:IGNORE.
  • Browser: paginating a table updates data rows while the wire:partial.ignore filter row keeps its DOM state.

How to verify

./vendor/bin/pest --compact tests/Feature/PartialsTest.php

With PowerGrid Flux (POWERGRID_PARTIALS_ENABLED=true), switch to Inline and confirm search, column sort, and pagination update the rows without destroying inline filters.

Notes

PowerGrid still needs to mark the inline-filter <tr> with wire:partial.ignore and call resolveFilters() before rendering tbody partials. That lives in the PowerGrid PR, not here.

@luanfreitasdev
luanfreitasdev merged commit 7affd1e into 1.x Aug 26, 2026
2 checks passed
@luanfreitasdev
luanfreitasdev deleted the fix/inline-table-partials branch August 26, 2026 11:49
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