Skip to content

Commit

Permalink
Override enable navigation for parent picker
Browse files Browse the repository at this point in the history
  • Loading branch information
benmerckx committed Dec 13, 2024
1 parent 39a3cdf commit 3c8cd31
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/dashboard/view/entry/NewEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,9 @@ function NewEntryForm({parentId}: NewEntryProps) {
const root = useRoot()
const parentField = useMemo(() => {
return entry('Parent', {
location: {
workspace,
root: root.name
},
location: {workspace, root: root.name},
condition: {_type: {in: containerTypes}},
enableNavigation: true,
initialValue: preselectedId
? {
[Reference.id]: 'parent',
Expand Down
3 changes: 2 additions & 1 deletion src/picker/entry/EntryPicker.browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ export function EntryPickerModal({
})
}
)
const withNavigation = Boolean(!options.condition && !options.pickChildren)
const withNavigation =
options.enableNavigation || (!options.condition && !options.pickChildren)
const query = useMemo((): QueryWithResult<ExporerItemSelect> => {
const terms = search.replace(/,/g, ' ').split(' ').filter(Boolean)
const filter = {
Expand Down
2 changes: 2 additions & 0 deletions src/picker/entry/EntryPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export interface EntryPickerConditions {
pickChildren?: boolean
/** Filter entries by a condition */
condition?: Filter<EntryFields & Entry>
/** Enable entry picker navigation */
enableNavigation?: boolean
}

export interface EntryPickerOptions<Definition = {}>
Expand Down

0 comments on commit 3c8cd31

Please sign in to comment.