Skip to content

Commit

Permalink
fix: improve intent handling
Browse files Browse the repository at this point in the history
  • Loading branch information
SimeonGriggs committed Sep 15, 2024
1 parent d2b2ecb commit ce1e382
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions src/desk-structure/orderableDocumentListDeskItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,32 @@ export function orderableDocumentListDeskItem(config: OrderableListConfig): List
.title(listTitle)
.id(listId)
.icon(listIcon)
.schemaType(type)
.child(
Object.assign(S.documentTypeList(type).serialize(), {
// Prevents the component from re-rendering when switching documents
__preserveInstance: true,
// Prevents the component from NOT re-rendering when switching listItems
key: listId,
Object.assign(
S.documentTypeList(type)
.canHandleIntent(() => !!createIntent)
.serialize(),
{
// Prevents the component from re-rendering when switching documents
__preserveInstance: true,
// Prevents the component from NOT re-rendering when switching listItems
key: listId,

type: 'component',
component: OrderableDocumentList,
options: {type, filter, params, client},
menuItems: [
...menuItems,
S.menuItem().title(`Reset Order`).icon(GenerateIcon).action(`resetOrder`).serialize(),
S.menuItem()
.title(`Toggle Increments`)
.icon(SortIcon)
.action(`showIncrements`)
.serialize(),
],
})
type: 'component',
component: OrderableDocumentList,
options: {type, filter, params, client},
menuItems: [
...menuItems,
S.menuItem().title(`Reset Order`).icon(GenerateIcon).action(`resetOrder`).serialize(),
S.menuItem()
.title(`Toggle Increments`)
.icon(SortIcon)
.action(`showIncrements`)
.serialize(),
],
}
)
)
.serialize()
}

0 comments on commit ce1e382

Please sign in to comment.