diff --git a/frontend/taipy/src/CoreSelector.tsx b/frontend/taipy/src/CoreSelector.tsx
index c42a767ac6..e7deb149e6 100644
--- a/frontend/taipy/src/CoreSelector.tsx
+++ b/frontend/taipy/src/CoreSelector.tsx
@@ -62,7 +62,6 @@ import {
BadgePos,
BadgeSx,
BaseTreeViewSx,
- EmptyArray,
FlagSx,
ParentItemSx,
getUpdateVarNames,
@@ -126,7 +125,7 @@ const tinyPinIconButtonSx = (theme: Theme) => ({
const switchBoxSx = { ml: 2, width: (theme: Theme) => `calc(100% - ${theme.spacing(2)})` };
const iconInRowSx = { fontSize: "body2.fontSize" };
-const labelInRowSx = {"& .MuiFormControlLabel-label": iconInRowSx};
+const labelInRowSx = { "& .MuiFormControlLabel-label": iconInRowSx };
const CoreItem = (props: {
item: Entity;
@@ -139,25 +138,27 @@ const CoreItem = (props: {
hideNonPinned: boolean;
active: boolean;
}) => {
- const [id, label, items = EmptyArray, nodeType, primary] = props.item;
+ const [id, label, items, nodeType, primary] = props.item;
const isPinned = props.pins[0][id];
const isShown = props.hideNonPinned ? props.pins[1][id] : true;
return !props.displayCycles && nodeType === NodeType.CYCLE ? (
<>
- {items.map((item) => (
-
- ))}
+ {items
+ ? items.map((item) => (
+
+ ))
+ : null}
>
) : isShown ? (
- {items.map((item) => (
-
- ))}
+ {items ?
+ items.map((item) => (
+
+ )) : null}
) : null;
};
@@ -374,7 +376,8 @@ const CoreSelector = (props: CoreSelectorProps) => {
setSelectedItems(() => {
const lovVar = getUpdateVar(updateVars, lovPropertyName);
const val = multiple ? nodeId : isSelectable ? nodeId : "";
- setTimeout( // to avoid set state while render react errors
+ setTimeout(
+ // to avoid set state while render react errors
() => dispatch(createSendUpdateAction(updateVarName, val, module, onChange, propagate, lovVar)),
1
);
@@ -526,15 +529,19 @@ const CoreSelector = (props: CoreSelectorProps) => {
localStoreSet(jsonFilters, id, lovPropertyName, "filter");
const filterVar = getUpdateVar(updateCoreVars, "filter");
const lovVar = getUpdateVarNames(updateVars, lovPropertyName);
- setTimeout(() => dispatch(
- createRequestUpdateAction(
- id,
- module,
- lovVar,
- true,
- filterVar ? { [filterVar]: filters } : undefined
- )
- ), 1);
+ setTimeout(
+ () =>
+ dispatch(
+ createRequestUpdateAction(
+ id,
+ module,
+ lovVar,
+ true,
+ filterVar ? { [filterVar]: filters } : undefined
+ )
+ ),
+ 1
+ );
return filters;
}
return old;
@@ -674,20 +681,22 @@ const CoreSelector = (props: CoreSelectorProps) => {
onItemExpansionToggle={onItemExpand}
>
{foundEntities
- ? foundEntities.map((item) => (
-
- ))
+ ? foundEntities.map((item) =>
+ item ? (
+
+ ) : null
+ )
: null}
>
diff --git a/taipy/gui/utils/_adapter.py b/taipy/gui/utils/_adapter.py
index 8e7aafa5f6..eacb2489d3 100644
--- a/taipy/gui/utils/_adapter.py
+++ b/taipy/gui/utils/_adapter.py
@@ -185,9 +185,21 @@ def __get_label(self, value: t.Any, dig=True) -> t.Union[str, t.Dict, None]:
def __get_children(self, value: t.Any) -> t.Optional[t.List[t.Any]]:
if isinstance(value, (tuple, list)) and len(value) > 2:
- return value[2] if isinstance(value[2], list) else [value[2]]
+ return value[2] if isinstance(value[2], list) else None if value[2] is None else [value[2]]
elif hasattr(value, "children"):
- return value.children if isinstance(value.children, list) else [value.children]
+ return (
+ value.children
+ if isinstance(value.children, list)
+ else None
+ if value.children is None
+ else [value.children]
+ )
elif hasattr(value, "__getitem__") and "children" in value:
- return value["children"] if isinstance(value["children"], list) else [value["children"]]
+ return (
+ value["children"]
+ if isinstance(value["children"], list)
+ else None
+ if value["children"] is None
+ else [value["children"]]
+ )
return None
diff --git a/taipy/gui_core/_context.py b/taipy/gui_core/_context.py
index 76d598740d..b4cd662223 100644
--- a/taipy/gui_core/_context.py
+++ b/taipy/gui_core/_context.py
@@ -693,7 +693,7 @@ def data_node_adapter(
raise NotImplementedError
if isinstance(data, list):
if data[2] and isinstance(data[2][0], (Cycle, Scenario, Sequence, DataNode)):
- data[2] = self.get_sorted_datanode_list(data[2], sorts, adapt_dn)
+ data[2] = self.get_sorted_datanode_list(data[2], sorts, False)
return data
try:
if hasattr(data, "id") and is_readable(data.id) and core_get(data.id) is not None:
@@ -715,7 +715,7 @@ def data_node_adapter(
self.data_nodes_by_owner.get(data.id, [])
+ (self.scenario_by_cycle or {}).get(data, []),
sorts,
- adapt_dn,
+ False,
),
_EntityType.CYCLE.value,
False,
@@ -727,7 +727,7 @@ def data_node_adapter(
self.get_sorted_datanode_list(
self.data_nodes_by_owner.get(data.id, []) + list(data.sequences.values()),
sorts,
- adapt_dn,
+ False,
),
_EntityType.SCENARIO.value,
data.is_primary,
@@ -737,7 +737,7 @@ def data_node_adapter(
return [
data.id,
data.get_simple_label(),
- self.get_sorted_datanode_list(datanodes, sorts, adapt_dn),
+ self.get_sorted_datanode_list(datanodes, sorts, False),
_EntityType.SEQUENCE.value,
]
except Exception as e: