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

[Bug]: Issue with SelectTree inside Repeater - Duplicated Items After Deleting an Item #134

Open
Sa-arash opened this issue Jan 6, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@Sa-arash
Copy link

Sa-arash commented Jan 6, 2025

What happened?

Hello my friend,

I am facing an issue with this package. When using SelectTree inside a Repeater with multiple items, I am experiencing unexpected behavior. When I delete an item from the middle or top of the list, the items below the deleted one get duplicated, and two input fields appear one below the other.

Here is a sample of the code I've written:

transaction1
transaction2
transaction3

Forms\Components\Repeater::make('transactions')
    ->reorderable(false)
    ->label('')
    ->schema([
        SelectTree::make('account_id')
            ->defaultOpenLevel(2)
            ->label('Account')
            ->required()
            ->searchable()
            ->relationship('Account', 'name', 'parent_id', modifyQueryUsing: fn($query) => $query->whereIn('stamp',['Assets','Liabilities',"Equity"])->where('hidden',0)->where('company_id', getCompany()->id)),
    ]);

How to reproduce the bug

When I have multiple items in a repeater and delete one of them, all the items below the deleted one get duplicated and turn into two SelectTree inputs.

Package Version

3.1.45

PHP Version

8.2.0

Laravel Version

11

Which operating systems does with happen with?

Windows, Linux

Notes

No response

@Sa-arash Sa-arash added the bug Something isn't working label Jan 6, 2025
@CodeWithDennis
Copy link
Owner

Its similar to #41 which i don't know how to resolve, feel free to give it a try.

@Sa-arash
Copy link
Author

Sa-arash commented Jan 6, 2025

Its similar to #41 which i don't know how to resolve, feel free to give it a try.

To better help, could you please provide more details about the issue you're referring to?

@CodeWithDennis
Copy link
Owner

Its similar to #41 which i don't know how to resolve, feel free to give it a try.

To better help, could you please provide more details about the issue you're referring to?

There is a bunch of context in that issue with a video.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants