filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.41k stars 2.87k forks source link

Method onValidationError is called twice #11118

Closed sglkc closed 8 months ago

sglkc commented 8 months ago

Package

filament/filament

Package Version

v3.0-stable

Laravel Version

v10.10

Livewire Version

No response

PHP Version

PHP 8.2.15

Problem description

The method onValidationError is called twice from custom pages that use InteractsWithForms. My temporary fix is to not use it.

Expected behavior

It should be called only once.

Steps to reproduce

  1. Create a custom page
  2. Add use InteractsWithForms
  3. Create a form and a submit method with validate
  4. Do not follow the rules and submit
  5. onValidationError will be called twice

Reproduction repository

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

Relevant log output

No response

danharrin commented 8 months ago

You do not need HasForms or InteractsWithForms when using a Filament page, we have those on the base Page class, and adding them again can cause issues like this