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

"Cancel" button on CreateModel page not working when persistTabInQueryString method is present #15363

Open
MarioGattolla opened this issue Jan 17, 2025 · 0 comments
Labels

Comments

@MarioGattolla
Copy link

MarioGattolla commented Jan 17, 2025

Package

filament/filament

Package Version

v3.2.133

Laravel Version

v11.38.2

Livewire Version

v3.0

PHP Version

PHP 8.2

Problem description

Hello. I created a Filament Resource with a "createModel" page. The "create" page has multiple Tabs with the "->persistTabInQueryString()" method. When i visit the page the url is :

http://test.it/invoices/create?tab=-first-tab

When i use the "cancel" button

Image

should return to the "ListModel" page but stay in the same page and the url changed in:

http://test.it/invoices/create

On second click return to "ListModel" page.

I tried with a second Tab. When i switch on second Tab the url is correct :

http://test.it/invoices/create?tab=-second-tab

if i use the "cancel" button the url change in :

http://test.it/invoices/create?tab=-first-tab

but the second Tab is still selected , on second click return on /create and on third return to "ListModel" page.

Already tested with PHP 8.4, problem persist

Tell me know if you need more info or something is unclear. Thank you

Expected behavior

Expected change page and return on "ListModel" page on "cancel" button. In case of two tabs i don't know whether it should return to the previous tab by changing the active tab or still return to "ListModel" page.

Steps to reproduce

Create a Model . Create a Resource with the "CreateModel" page. Fill the form method like this :

    return $form

        ->schema([
            Tabs::make("test")
                ->persistTabInQueryString()
                ->schema([
                Tab::make("first tab")->schema([
                    Placeholder::make("created_at")
                        ->label("Created Date")
                        ->content(fn(?Invoice $record): string => $record?->created_at?->diffForHumans() ?? "-"),

                    Placeholder::make("updated_at")
                        ->label("Last Modified Date")
                        ->content(fn(?Invoice $record): string => $record?->updated_at?->diffForHumans() ?? "-"),
                ]),
                    Tab::make("second tab")->schema([
                        Placeholder::make("created_at")
                            ->label("Created Date")
                            ->content(fn(?Invoice $record): string => $record?->created_at?->diffForHumans() ?? "-"),

                        Placeholder::make("updated_at")
                            ->label("Last Modified Date")
                            ->content(fn(?Invoice $record): string => $record?->updated_at?->diffForHumans() ?? "-"),
                    ])
            ]),
        ]);

Change the Invoice Model name in the code with your Model name

You can check the repository below using the Invoice Resource

Reproduction repository (issue will be closed if this is not valid)

https://github.com/MarioGattolla/filament-issue

Relevant log output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

1 participant