Hasnayeen / themes

Themes for Filament panels.
MIT License
234 stars 31 forks source link

[Bug]: Plugin not working when mode is user #50

Closed michele-grifa closed 7 months ago

michele-grifa commented 7 months ago

What happened?

Currently the plugin only works if is set to global mode. If is set to user mode, the plugin correctly update the columns in the database for the user but the theme is not changed.

How to reproduce the bug

Package Version

3.0.22

Filament Version

3.2.61

PHP Version

8.1.25

Laravel Version

10.48.4

Notes

No response

Hasnayeen commented 7 months ago

have you added SetTheme middleware in the panel provider?

michele-grifa commented 7 months ago

Yes, i put it first, but the order doesn't change the behavior .

In another project that has tenancy, the problem is the same.

Hasnayeen commented 7 months ago

can't reproduce locally, can you try clearing config cache or check in SetTheme middleware line 48 if it returns correct theme after changing a theme

michele-grifa commented 7 months ago

Tomorrow i will try.

michele-grifa commented 7 months ago

I tried to config cache without success. At line 48 the theme is always the DefaultTheme. If I put the middleware after all default Filament ones, it works.

michele-grifa commented 7 months ago

It works with tenancy too.

Hasnayeen commented 7 months ago

yes, the middleware have to come after the authenticate middleware otherwise there is no user yet when it is run