From 348803484abdc159e877c322f4ded7c51773b302 Mon Sep 17 00:00:00 2001 From: Andreas Reinhold / reini Date: Tue, 15 Sep 2026 01:09:13 +0200 Subject: [PATCH] Keep a deferred wire:model on the tabs deferred Plan step 36, navigation review. The tabs rewrite appended `.live` to @entangle, so every tab set bound with a plain wire:model sent a request on each click. @entangle already adds `.live` for wire:model.live, which the view's own header promises is the caller's choice. Pinned for both spellings. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9 --- resources/views/components/tabs.blade.php | 2 +- tests/Feature/Components/TabsTest.php | 30 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/resources/views/components/tabs.blade.php b/resources/views/components/tabs.blade.php index f65c92ff..c14ae8ff 100644 --- a/resources/views/components/tabs.blade.php +++ b/resources/views/components/tabs.blade.php @@ -42,7 +42,7 @@
toMatch('/id="[^"]+-people-panel"(?![^>]*style="display: none")/'); }); +it('tells the server at once only when the caller asked with wire:model.live', function () { + Livewire::component('tabs-deferred-probe', new class extends Component + { + public string $tab = 'files'; + + public function render(): string + { + return '
'; + } + }); + + Livewire::component('tabs-live-probe', new class extends Component + { + public string $tab = 'files'; + + public function render(): string + { + return '
'; + } + }); + + // @entangle appends `.live` itself for `wire:model.live`; the view adds nothing of its own, so a + // deferred `wire:model` stays deferred. + $live = Livewire::test('tabs-live-probe')->html(); + + expect(Livewire::test('tabs-deferred-probe')->html())->toContain(".entangle('tab')")->not->toContain(".entangle('tab').live") + ->and(substr_count($live, ".entangle('tab').live"))->toBe(1) + ->and($live)->not->toContain('.live.live'); +}); + it('keeps the tab bar on M3\'s offsets, indicator inset and focus ring', function () { $css = ComponentStylesheet::read('tabs');