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(validation): remove repeat paths in markers #2713

Merged
merged 3 commits into from
Aug 27, 2021

Conversation

ricokahler
Copy link
Contributor

@ricokahler ricokahler commented Aug 27, 2021

Description

This PR fixes a regression in the validation refactor.

When I did the refactor, I didn't understand that the path inside of ValidationError was supposed to be relative to the current value (for array and object values).

I was previously incorrectly appending item-level paths. The refactor passes the validation context around more freely so the applyPathPrefix function was redundant.

What to review

  • Try out all validation and especially try validation with items that create markers to nested value inside the current value (e.g. array items and uniqueness, array items and Rule.valid values, custom block editors).
  • Review the new tests. I mocked a bit more and to re-create the error. This was known to happen with slugs.

Notes for release

Fixes regression in @sanity/validation regarding incorrect marker paths (#2713). This fixes focus issues in the validation list.

@vercel
Copy link

vercel bot commented Aug 27, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

perf-studio – ./

🔍 Inspect: https://vercel.com/sanity-io/perf-studio/2tKJS9T7kPd74x52Qno52bNf9kDd
✅ Preview: https://perf-studio-git-fix-ch10895repeat-paths-in-markers.sanity.build

test-studio – ./

🔍 Inspect: https://vercel.com/sanity-io/test-studio/9svevBgvWzwxF6qSXbgPMnPrB6NJ
✅ Preview: https://test-studio-git-fix-ch10895repeat-paths-in-markers.sanity.build

@ricokahler ricokahler changed the base branch from next to chore/typescript-4-4 August 27, 2021 03:59
@bjoerge bjoerge changed the base branch from chore/typescript-4-4 to next August 27, 2021 10:04
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.

None yet

1 participant