Skip to content

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

Closed
@MarioGattolla

Description

@MarioGattolla

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    • Status

      Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions