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