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

Builder bug with addActionBetween #12825

Open
awcodes opened this issue May 16, 2024 · 1 comment
Open

Builder bug with addActionBetween #12825

awcodes opened this issue May 16, 2024 · 1 comment
Labels
bug Something isn't working confirmed medium priority
Milestone

Comments

@awcodes
Copy link
Contributor

awcodes commented May 16, 2024

Package

filament/filament

Package Version

v3.2.40

Laravel Version

v11.7.0

Livewire Version

v3.4.12

PHP Version

PHP 8.2.8

Problem description

When adding items with the addBetweenAction once there are 4-5 items in the state the last item looses its alpine data somehow resulting in alpine throwing up in the console because ‘isCollapsed’ is undefined.

But then it reinitializes itself. But continues to not have the alpine data set on any following actions.

So if you click on collapse all they all collapse except that one. But the bug still happens regardless of collapsible or not.
addAction doesn’t seem to trigger the issue, probably because the new item is always at the end of the state array.

Expected behavior

Blocks do not loose their alpine x-data properties.

Steps to reproduce

Screen.Recording.2024-05-16.at.8.47.17.AM.mov

Reproduction repository

https://github.com/awcodes/builder-bug

Relevant log output

Alpine Expression Error: isCollapsed is not defined

Expression: "{ 'fi-collapsed overflow-hidden': isCollapsed }"

 
<li class="fi-fo-builder-item round…te/5 dark:ring-white/10" wire:key="PbiK2x6DQxx8eyCmZdri.dat…omponents\\Builder.item" x-data="{\n                     …                      }" x-init="() => console.log(`init …0b7-85aa-a6cee2bf0343`)" x-on:builder-expand.window="$event.detail === 'data.…& (isCollapsed = false)" x-on:builder-collapse.window="$event.detail === 'data.…&& (isCollapsed = true)" x-on:expand="isCollapsed = false" x-sortable-item="f2c27680-717b-40b7-85aa-a6cee2bf0343" x-bind:class="{ 'fi-collapsed overflow-hidden': isCollapsed }" data-has-alpine-state="true">
livewire.js:1123:13
Alpine Expression Error: isCollapsed is not defined

Expression: "{ '-rotate-180': isCollapsed }"

 
<li class="relative transition" x-on:click.stop="isCollapsed = !isCollapsed" x-bind:class="{ '-rotate-180': isCollapsed }">
livewire.js:1123:13
Alpine Expression Error: isCollapsed is not defined

Expression: "{ 'opacity-0 pointer-events-none': isCollapsed }"

 
<div class="transition" x-bind:class="{ 'opacity-0 pointer-events-none': isCollapsed }">
livewire.js:1123:13
Alpine Expression Error: isCollapsed is not defined

Expression: "{ 'opacity-0 pointer-events-none': ! isCollapsed }"

 
<div class="absolute inset-0 rotate-180 transition" x-bind:class="{ 'opacity-0 pointer-events-none': ! isCollapsed }">
livewire.js:1123:13
Alpine Expression Error: isCollapsed is not defined

Expression: "! isCollapsed"

 
<div class="fi-fo-builder-item-conte…-4 dark:border-white/10" x-show="! isCollapsed">

Donate 💰 to fund this issue

  • You can donate funding to this issue. We receive the money once the issue is completed & confirmed by you.
  • 100% of the funding will be distributed between the Filament core team to run all aspects of the project.
  • Thank you in advance for helping us make maintenance sustainable!
Fund with Polar
@awcodes awcodes added bug Something isn't working confirmed medium priority labels May 16, 2024
@zepfietje zepfietje added this to the v3 milestone Jun 1, 2024
@dmitry-udod
Copy link
Contributor

This is a really interesting bug, and it seems to occur in Livewire itself when you change the order of keys in an existing array.
Livewire stops seeing the x-data directive, even though it is present in the HTML ¯_(ツ)_/¯. The problem disappears when you use a new key (UUID) for existing array items.

Screencast.2024-06-03.10.31.50.mp4

I'm not sure if this is a valid solution for the bug, but it provides some additional information.

@polar-sh polar-sh bot added the Fund label Jun 3, 2024
@danharrin danharrin removed the fund label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed medium priority
Projects
Status: Todo
Development

No branches or pull requests

4 participants