From 23086e26aa5d94395ca62423d22c0a80ff83ef9c Mon Sep 17 00:00:00 2001 From: Jordan Lawrence Date: Thu, 5 Sep 2024 14:01:09 +0100 Subject: [PATCH] refactor(core): minor type usage improvement and using task plugin name (#7453) * refactor(core): improved typescript usage of collate for use with collecting drafts * refactor(tasks): tasks plugin name uses var --- .../core/form/studio/inputs/client-adapters/reference.ts | 8 +++++--- .../inputs/crossDatasetReference/datastores/search.ts | 2 +- packages/sanity/src/core/tasks/plugin/index.tsx | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/sanity/src/core/form/studio/inputs/client-adapters/reference.ts b/packages/sanity/src/core/form/studio/inputs/client-adapters/reference.ts index e8efc9f7856..391ffaa5fc2 100644 --- a/packages/sanity/src/core/form/studio/inputs/client-adapters/reference.ts +++ b/packages/sanity/src/core/form/studio/inputs/client-adapters/reference.ts @@ -131,7 +131,10 @@ export function getReferenceInfo( ) const value$ = combineLatest([draftPreview$, publishedPreview$]).pipe( - map(([draft, published]) => ({draft, published})), + map(([draft, published]) => ({ + draft, + published, + })), ) return value$.pipe( @@ -144,7 +147,6 @@ export function getReferenceInfo( pairAvailability.published.reason === 'PERMISSION_DENIED' ? PERMISSION_DENIED : NOT_FOUND - return { type: typeName, id: publishedId, @@ -201,7 +203,7 @@ export function referenceSearch( }) return search(textTerm, {includeDrafts: true}).pipe( map(({hits}) => hits.map(({hit}) => hit)), - map(collate), + map((docs) => collate(docs)), // pick the 100 best matches map((collated) => collated.slice(0, 100)), mergeMap((collated) => { diff --git a/packages/sanity/src/core/form/studio/inputs/crossDatasetReference/datastores/search.ts b/packages/sanity/src/core/form/studio/inputs/crossDatasetReference/datastores/search.ts index f588326d102..2b8fe92f93d 100644 --- a/packages/sanity/src/core/form/studio/inputs/crossDatasetReference/datastores/search.ts +++ b/packages/sanity/src/core/form/studio/inputs/crossDatasetReference/datastores/search.ts @@ -31,7 +31,7 @@ export function search( isCrossDataset: true, }).pipe( map(({hits}) => hits.map(({hit}) => hit)), - map(collate), + map((docs) => collate(docs)), map((collated) => collated.map((entry) => ({ id: entry.id, diff --git a/packages/sanity/src/core/tasks/plugin/index.tsx b/packages/sanity/src/core/tasks/plugin/index.tsx index e97231e70aa..52a46e27b02 100644 --- a/packages/sanity/src/core/tasks/plugin/index.tsx +++ b/packages/sanity/src/core/tasks/plugin/index.tsx @@ -18,7 +18,7 @@ export const TASKS_NAME = 'sanity/tasks' * @beta */ export const tasks = definePlugin({ - name: 'sanity/tasks', + name: TASKS_NAME, // eslint-disable-next-line camelcase __internal_tasks: { footerAction: ,