sanity icon indicating copy to clipboard operation
sanity copied to clipboard

fix(desk-tool): refine intent resolver

Open ricokahler opened this issue 3 years ago • 1 comments

Description

The following PR:

  1. adds timeouts and guards to the resolveIntent function to prevent it from never resolving (by returning the fallback editor in many cases).
  2. moves the extra documentList case (i.e. pane.type === 'documentList' && pane.schemaTypeName === params.type && pane.options.filter === '_type == $type') into the default intent checker in structure. This should give users more control so they could opt-out of that behavior.
  3. adds the method disableNestedIntentResolution() to the structure builder to stop the intent resolver from traversing the list. This will help in the cases where lists are very long or infinitely recursive and we want users to opt out of that behavior.

What to review

See the new APIs and whether or not they make sense. Try out the new options in structure too.

Since these add to the existing structure, I think makes sense to update docs for this as well. I'll get the process going internally soon.

Notes for release

  • Adds timeouts and fallbacks to the intent resolver
  • Adds S.list.disableNestedIntentResolution() to disable the intent resolver from searching in that list for intent handlers.

ricokahler avatar Nov 21 '21 20:11 ricokahler

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/D4RJbRj56v3FjrbTomNUmFj9KRCX
✅ Preview: https://perf-studio-git-fix-sc-12713intent-resolver-guards.sanity.build

test-studio – ./

🔍 Inspect: https://vercel.com/sanity-io/test-studio/HfbatAtjJZ1LWHJq9a8xJYUkMbqx
✅ Preview: https://test-studio-git-fix-sc-12713intent-resolver-guards.sanity.build

studio-workshop – ./dev/workshop

🔍 Inspect: https://vercel.com/sanity-io/studio-workshop/Bgnia4paWfKiwGYZ9pCxK66KKJht
✅ Preview: https://studio-workshop-git-fix-sc-12713intent-resolver-guards.sanity.build

vercel[bot] avatar Nov 21 '21 20:11 vercel[bot]

@rexxars is this still needed or it can be closed given it's ~3 years old and it's for v2

binoy14 avatar Jul 10 '23 13:07 binoy14