Skip to content
This repository was archived by the owner on Jul 26, 2026. It is now read-only.

FIx route [filament.xxx.index] not defined - #42

Open
liyuze wants to merge 1 commit into
GuavaCZ:mainfrom
liyuze:main
Open

FIx route [filament.xxx.index] not defined#42
liyuze wants to merge 1 commit into
GuavaCZ:mainfrom
liyuze:main

Conversation

@liyuze

@liyuze liyuze commented Aug 13, 2024

Copy link
Copy Markdown

FIx route [filament.xxx.index] not defined at /livewire/update request

public static function form(Form $form): Form
    {
        return $form
            ->schema([
                 Forms\Components\FileUpload::make('img');
            ]);
    }

When the FileUpload component is present, the system automatically sends a /livewire/update request (calls: [{path: "", method: "getFormUploadedFiles", params: ["data.img"]}]). The response body of this request triggers an exception: route [filament.xxx.index] not defined.

//file:Guava\FilamentNestedResources\Pages\CreateRelatedRecord

    public function mount(int | string $record): void
    {
        $this->ownerRecord = $this->resolveRecord($record);
        $this->record = null;

        $this->authorizeAccess();

        $this->fillForm();

        $this->previousUrl = url()->previous();
    }

    protected function getCancelFormAction(): Action
    {
        return Action::make('cancel')
            ->label(__('filament-panels::resources/pages/create-record.form.actions.cancel.label'))
            ->url($this->previousUrl ?? static::getResource()::getUrl())
            ->color('gray')
        ;
    }

The error occurs in the getCancelFormAction() method. In subsequent component calls, the mount() method is not executed, causing the previousUrl value to be null. To resolve this, previousUrl should be set as a public property so that its value can be passed between requests.

FIx route [filament.xxx.index] not defined at /livewire/update request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant