bezhanSalleh / filament-panel-switch

The Panel Switch Plugin for Filament offers a robust and customizable component for switching between panels in applications built with FilamentPHP.
MIT License
123 stars 21 forks source link

[Bug]: It cannot switch to default panel, if default panel has path = '/' #9

Closed mansoorkhan96 closed 1 year ago

mansoorkhan96 commented 1 year ago

What happened?

I have added two panels. 1) Admin panel on / path 2) Another panel on /x path

I can switch from Admin to another panel but switching back to Admin panel does not work when the path is /. If i change the path to something else i works.

This would not work

return $panel
    ->default()
    ->id('admin')
    ->path('/')

This would work

return $panel
    ->default()
    ->id('admin')
    ->path('/admin')

How to reproduce the bug

1) Create Two panels in your filament application, 1.1) Admin Panel: set path to / 1.1) Editor Panel: set path to /editor 2) go browser switch to editor panel 3) switch back to Admin panel 4) you can not switch back and in url it shows: about:blank#blocked

Package Version

1.0.1

PHP Version

8.2

Laravel Version

10

Which operating systems does with happen with?

macOS

Notes

No response

bezhanSalleh commented 1 year ago

the path for the panel is already set to root '/' that's why when set the path it needs to be path('app|whateverYouAppropriateForYou'). so in your case when you do path('/') it appends another '/' to the path so you get '//' and it won't work.