Fix dynamic loading of nodes
This commit is contained in:
parent
593cb357b3
commit
d7219cc9c5
|
|
@ -9,6 +9,7 @@ import {
|
|||
type RenderTreeNodePayload,
|
||||
Space,
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
Tree,
|
||||
type TreeNodeData,
|
||||
|
|
@ -176,7 +177,7 @@ export default function NavigationTree({
|
|||
label: (
|
||||
<Group gap='xs'>
|
||||
<ApiIcon name={raw.icon} />
|
||||
{raw.name}
|
||||
<Text>{raw.name}</Text>
|
||||
</Group>
|
||||
),
|
||||
value: raw.pk.toString(),
|
||||
|
|
@ -216,7 +217,7 @@ export default function NavigationTree({
|
|||
// After fetching (or in search mode where all data is already present), use actual children.
|
||||
const hasChildren: boolean =
|
||||
!debouncedSearch && !isFetched
|
||||
? !!resolveItem(payload.node, childIdentifier ?? '')
|
||||
? !!(childIdentifier && resolveItem(payload.node, childIdentifier))
|
||||
: nodeInfo.children.length > 0;
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -377,6 +377,7 @@ export default function CategoryDetail() {
|
|||
modelType={ModelType.partcategory}
|
||||
title={t`Part Categories`}
|
||||
endpoint={ApiEndpoints.category_tree}
|
||||
childIdentifier='subcategories'
|
||||
opened={treeOpen}
|
||||
onClose={() => {
|
||||
setTreeOpen(false);
|
||||
|
|
|
|||
|
|
@ -514,6 +514,7 @@ export default function Stock() {
|
|||
title={t`Stock Locations`}
|
||||
modelType={ModelType.stocklocation}
|
||||
endpoint={ApiEndpoints.stock_location_tree}
|
||||
childIdentifier='sublocations'
|
||||
opened={treeOpen}
|
||||
onClose={() => setTreeOpen(false)}
|
||||
selectedId={location?.pk}
|
||||
|
|
|
|||
|
|
@ -1066,6 +1066,7 @@ export default function StockDetail() {
|
|||
title={t`Stock Locations`}
|
||||
modelType={ModelType.stocklocation}
|
||||
endpoint={ApiEndpoints.stock_location_tree}
|
||||
childIdentifier='sublocations'
|
||||
opened={treeOpen}
|
||||
onClose={() => setTreeOpen(false)}
|
||||
selectedId={stockitem?.location}
|
||||
|
|
|
|||
Loading…
Reference in New Issue