Skip to content

Conversation

@godismyjudge95
Copy link
Contributor

This PR fixes:

Fixing these issues was previously attempted here: #11341


When receiving errors for validation it is nice to know in which row/set the validation error occurs. This PR adds this functionality by doing the following:

  • Cache errors immediately on page load and associate them to the row/set ids
  • Pass the errors down to the row/set based on their id
  • Listen for error updates and re-cache based on the row/set id - this is safe to do at this point because all the re-ordered rows/sets will have been sent to the server for validation and the new errors will be referencing their new indexes

Additionally, I noticed that the nested field errors are also dependent upon the row/set index. This means that if the row/set is deleted or moved then the validation errors do not "follow" the field and can jump to the wrong row/set if it contains similar fields. I resolved this by caching the field errors on page load and only updating them when the errors update not when the field prefix (ie. row/set index) is updated.

Please let me know if there's anything that is unclear about this; sorry for the wordy explanation.

Here is what it looks like:
image

@jasonvarga jasonvarga changed the title [6.x] Error indicator for grid/replicator row/set based on id [6.x] Error indicator for grid/replicator/bard based on id Jul 24, 2025
@jasonvarga jasonvarga merged commit 3df0400 into statamic:master Jul 24, 2025
18 checks passed
@godismyjudge95 godismyjudge95 deleted the fix-error-indexes-for-sets-and-rows branch July 24, 2025 19:44
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.

2 participants