#10768·livewire

`wire:island.append`: appended rows are rebuilt (typed input lost) when an `always: true` island re-renders the full list

Author: kobykormanCreated Sep 28, 2026Updated Sep 28, 2026

Livewire version

v4.4.6

Laravel version

v13.33.0

PHP version

8.5.10

Browser and operating system

Chromium on macOS 27.0 (not browser-specific: it comes from how the morph pairs blocks)

Describe the issue you're experiencing

After a wire:island.append, the next render of the island rebuilds every appended row instead of morphing it, even when the render returns the complete, correct list. Anything held in those rows' DOM is lost: typed input values, Alpine state, focus. Rows from the first render are kept.

Related, but not the same:

  • #9786 was answered as an architectural constraint because the re-render there returned only the current page, so the appended content was legitimately replaced. Here the re-render returns every loaded row, in order, with the same keys.
  • #10657 / #10659 fixed children mounted during an island render being dropped from the children memo. That fix is in place (v4.4.6); this is the DOM side.

Cause: Fragment.append() (js/fragment.js) inserts the incoming island HTML as-is before the end marker, including the <!--[if BLOCK]><![endif]--> / <!--[if ENDBLOCK]><![endif]--> markers the @foreach was compiled with. After one append the island holds two loop blocks; a full render produces one. When both cursors sit on a block start, the morph pairs the first old block with the first new block and looks up keys only inside that pair, so the rows in the second old block find no match: they are cloned from the new HTML and the old block is removed. Fragment.append() / prepend() are unchanged since #9483 (4.x and main).

Code snippets to reproduce the issue

blade
<?php

use Livewire\Component;

new class extends Component {
    public int $loaded = 3;

    public int $renders = 0;

    protected ?int $appendFrom = null;

    public function loadMore(): void
    {
        $this->appendFrom = $this->loaded;
        $this->loaded += 3;
    }

    public function rerender(): void
    {
        $this->renders++;
    }

    // An append renders only the new rows; every other render renders every loaded row.
    public function rows(): array
    {
        return $this->appendFrom === null
            ? range(1, $this->loaded)
            : range($this->appendFrom + 1, $this->loaded);
    }
};
?>

<div>
    <ul>
        @island(name: 'rows', always: true)
            @foreach ($this->rows() as $i)
                <li wire:key="row-{{ $i }}">Row {{ $i }} <input></li>
            @endforeach
        @endisland
    </ul>

    <button type="button" wire:click="loadMore" wire:island.append="rows">Load more</button>
    <button type="button" wire:click="rerender">Re-render ({{ $renders }})</button>
</div>
  1. Click Load more: rows 4–6 appear.
  2. Type something into all six inputs.
  3. Click Re-render.

Result: rows 1–3 keep their text; rows 4–6 are empty (new elements).

Screenshots/screen recordings

Not needed; the steps above show it.

How do you expect it to work?

The re-render returns the same six keyed rows, so all six should be morphed in place and keep their input values, as the morphing docs describe.

A possible fix: when an append (or prepend) lands next to a loop block, join the two, dropping the ENDBLOCK / BLOCK pair at the seam, so the island holds one block, the shape a full render produces. Doing that in the browser after each append fixes the repro above:

javascript
// island = the island's parent element
const is = (n, t) => n?.nodeType === 8 && n.textContent === t
const next = (n) => { let x = n.nextSibling; while (x?.nodeType === 3 && ! x.textContent.trim()) x = x.nextSibling; return x }
;[...island.childNodes].forEach((n) => {
    const after = is(n, '[if ENDBLOCK]><![endif]') ? next(n) : null
    if (is(after, '[if BLOCK]><![endif]')) { n.remove(); after.remove() }
})

Please confirm (incomplete submissions will not be addressed)

  • I have provided easy and step-by-step instructions to reproduce the bug.
  • I have provided code samples as text and NOT images.
  • I understand my bug report will be removed if I haven't met the criteria above.