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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

liyuze
Copy link

@liyuze liyuze commented Aug 13, 2024

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant