Skip to content

Commit

Permalink
refactor(core): minor type usage improvement and using task plugin na…
Browse files Browse the repository at this point in the history
…me (#7453)

* refactor(core): improved typescript usage of collate for use with collecting drafts

* refactor(tasks): tasks plugin name uses var
  • Loading branch information
jordanl17 authored and ricokahler committed Sep 6, 2024
1 parent e6b0614 commit 23086e2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -144,7 +147,6 @@ export function getReferenceInfo(
pairAvailability.published.reason === 'PERMISSION_DENIED'
? PERMISSION_DENIED
: NOT_FOUND

return {
type: typeName,
id: publishedId,
Expand Down Expand Up @@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/src/core/tasks/plugin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: <TasksFooterOpenTasks />,
Expand Down

0 comments on commit 23086e2

Please sign in to comment.