statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
3.7k stars 508 forks source link

Asset field errors not clearing after successful form submission #9138

Open robdekort opened 9 months ago

robdekort commented 9 months ago

Bug description

When you trigger an asset field error in a form using Precognition, it doesn't get cleared. Jason and I just witnessed this. He knows more about what's actually going on. This could be a Precognition issue instead of a Statamic one.

How to reproduce

  1. Create a from using precognition
  2. Add a required asset field
  3. Try to submit the form without an asset
  4. Clear all errors and submit the form with success.

The asset field error remains. This is probably easiest to test in Peak as that shows the remaining errors visually on screen already.

Logs

No response

Environment

Environment
Application Name: Statamic Peak Development
Laravel Version: 10.35.0
PHP Version: 8.2.10
Composer Version: 2.5.8
Environment: local
Debug Mode: ENABLED
URL: statamic-peak.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 4
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.38.0 PRO

Statamic Addons
studio1902/statamic-peak-browser-appearance: 3.3.2
studio1902/statamic-peak-commands: 3.0.0
studio1902/statamic-peak-seo: 7.3.1
studio1902/statamic-peak-tools: 4.0.1

Installation

Starter Kit using via CLI

Antlers Parser

None

Additional details

No response

ryanmitchell commented 9 months ago

I've taken a look into this and while you can get rid of the precognitive error by sending over the file name instead of a file object, that then causes issues when you actually submit the form due to it not being a file object.

I wonder if we just filter out validation on asset fields in precognitive requests?

duncanmcclean commented 9 months ago

Re-opening since the linked PR doesn't actually fix the issue reported here (the messages not being cleared after a successful submission), it simply prevents validation from being done on asset fields before the form is submitted.