Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression on x-ignore when removed #4458

Merged
merged 2 commits into from
Dec 2, 2024
Merged

Conversation

SimoTod
Copy link
Collaborator

@SimoTod SimoTod commented Nov 29, 2024

Release v3.14.4 introduce an _x_marker property to flag elements that were already initialised so they don't get initialised again when moved around (I think it was causing some issues in Livewire). However the code was also marking as initialised elements that were skipped by x-ignore.

This causes issues if x-ignore is removed and people calls initTree on the element: the subtree is initialised but the parent is skipped even if it wasn't previously initialised so, if it has x-data, it will trigger errors.

See #4457

This PR changes the logic so _x_marker is not added when the element has x-ignore

@SimoTod SimoTod marked this pull request as ready for review November 29, 2024 22:18
Copy link
Contributor

@ekwoka ekwoka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite sensible

@s-kitade
Copy link

s-kitade commented Dec 2, 2024

Does this mean that this problem will be solved?

sono1.mov
sono2.mov

code

    public function setNumbers()
    {
        $this->numbers = [1,2,3,4,5];
    }
<h2>Alpine.js ver 3.14.4</h2>
    <button wire:click="setNumbers">フォームたくさん</button>

    <div id="your-element-id" x-data="{ text :'' }">
        <span x-text="test"></span>
        @foreach($numbers as $number)
            <input type="text" x-model="text">
        @endforeach
    </div>

@SimoTod
Copy link
Collaborator Author

SimoTod commented Dec 2, 2024

@s-kitade that code doesn't use x-ignore so no, it won't.
However, the last version is 3.14.5 which resolved another bug so it may be fixed already

@calebporzio
Copy link
Collaborator

Legend, thanks @SimoTod

@calebporzio calebporzio merged commit b6394e6 into main Dec 2, 2024
2 checks passed
@calebporzio calebporzio deleted the bug/x-ignore-regression branch December 2, 2024 15:36
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.

4 participants