Skip to content

[Bug]: Sometimes not SelectTree render correctly #141

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

Closed
dgironella opened this issue Feb 17, 2025 · 14 comments
Closed

[Bug]: Sometimes not SelectTree render correctly #141

dgironella opened this issue Feb 17, 2025 · 14 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@dgironella
Copy link

What happened?

Sometime with no errors on console, SelectTree is not correctly rendered. If i reload page always is correctly rendered.

Image

Image

How to reproduce the bug

I can't reproduce it.

Package Version

3.1.45

PHP Version

8.3.16

Laravel Version

11.42.1

Which operating systems does with happen with?

macOS

Notes

Filament version 3.2.140

@dgironella dgironella added the bug Something isn't working label Feb 17, 2025
@Hegyusz
Copy link

Hegyusz commented Feb 25, 2025

Same issue happens with me also. Couldn't really reproduce it, why.

Image

@CodeWithDennis
Copy link
Owner

CodeWithDennis commented Feb 25, 2025

Could you check if spa() is enabled and check if it is fixed when you turn that off?

@dgironella
Copy link
Author

Could you check if spa() is enabled and check if it is fixed when you turn that off?

Yes, disable spa() not more problems, but spa is good for performance and user experience?

@CodeWithDennis
Copy link
Owner

Could you check if spa() is enabled and check if it is fixed when you turn that off?

Yes, disable spa() not more problems, but spa is good for performance and user experience?

I agree! I was just wondering if that was the issue. My knowledge on this problem is limited, so I’m not sure how to fix it. Maybe I could ask for some help on this.

@CodeWithDennis CodeWithDennis added the help wanted Extra attention is needed label Feb 25, 2025
@mgkimsal
Copy link
Contributor

mgkimsal commented Mar 6, 2025

Also spa() disable here fixes this on my end - recent filament (3.2.141?) and php 8.3.x

can't find a root issue but will try to look this weekend.

@pavloselpidorou
Copy link

Also having the same issue. I have disabled the spa() option on my panel provider and it is working. Anyone found a solution to this while keeping the spa() enabled?

@ineffablesam
Copy link

ineffablesam commented Mar 15, 2025

This can be added to your FilamentServiceProvider to disable SPA for specific pages while keeping it enabled for others.
this is just a workaround.

->spaUrlExceptions(fn(): array => [
    '*/admin/products/*',
])

mgkimsal added a commit to mgkimsal/filament-select-tree that referenced this issue Apr 6, 2025
Introduce a `treeKey` property and associated methods to allow customization of the tree identifier. Updated Blade template to use the specified tree key for the `wire:key` attribute to ensure predictable component rendering.

This is to address issue CodeWithDennis#141.
@mgkimsal
Copy link
Contributor

mgkimsal commented Apr 6, 2025

@CodeWithDennis - provided a patch that's working for me. I was seeing that even if it would render 'correctly', rerendering after some update would cause it to be hidden.

The 'rand' are a wire:key seemed off to me. Putting in a definable key that remains the same throughout rerenders has fixed this for me. Hopefully this is a 'correct' patch and will work for others too.

EDIT: it doesn't solve the initial render issue with spa mode on. But the spaURLException stuff doesn't seem like it's being called (see other comment).

The PR fix addresses a related issue I was seeing, where after interacting with the select tree (removing a selected option, for example) it would disappear (as in the images provided).

@mgkimsal
Copy link
Contributor

mgkimsal commented Apr 6, 2025

The 'FilamentView::hasSpaMode()' isn't calling anything that can use the spaURLExceptions, it seems. A bit hard to follow, but I see two hasSpaMode() calls in filament framework. The one that checks for spaUrlExceptions needs a url to be passed in to it, which the select-tree.blade.php isn't doing.

EDIT: added patch for that in the same PR

@AsmitNepali
Copy link

AsmitNepali commented Apr 24, 2025

I've installed the latest patch #154 , but I'm still experiencing the SPA rendering issue.
I'm currently using Filament version 3.2.4.

@mgkimsal @CodeWithDennis Is there anything I might be missing?

SelectTree::make('parent_child_category')
        ->relationship('category', 'name', 'parent_id'),

@smiliyas
Copy link

smiliyas commented May 2, 2025

@AsmitNepali can you confirm is this patch #157 fixes your issue?

@CodeWithDennis
Copy link
Owner

@AsmitNepali can you confirm is this patch #157 fixes your issue?

Could you check this @AsmitNepali ?

@AsmitNepali
Copy link

AsmitNepali commented May 13, 2025

@AsmitNepali can you confirm is this patch #157 fixes your issue?

Could you check this @AsmitNepali ?

@CodeWithDennis @smiliyas Thank you! It looks like that fixed the issue.

@CodeWithDennis
Copy link
Owner

Perfect, im gonna do some checks this week and will release it somewhere this week. - @AsmitNepali @smiliyas

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

No branches or pull requests

8 participants