Skip to content

Commit 068e038

Browse files
committed
fix bug if no groups exist
1 parent 130f599 commit 068e038

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/AiidaExplorer/GroupsViewer/index.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function formatTableData(nodes, setRootNodeId, isSmallScreen = false) {
6161

6262
columnOrder.forEach((label) => {
6363
const key = Object.keys(columnLabels).find(
64-
(k) => columnLabels[k] === label
64+
(k) => columnLabels[k] === label,
6565
);
6666
if (key && row[key] !== undefined) {
6767
newRow[label] = formatValue(label, row[key], isSmallScreen);
@@ -135,7 +135,7 @@ export default function GroupsViewer({ restApiUrl, setRootNodeId }) {
135135
const nodes = result.node || [];
136136

137137
setRawTableData((prev) =>
138-
offsetValue === 0 ? nodes : [...prev, ...nodes]
138+
offsetValue === 0 ? nodes : [...prev, ...nodes],
139139
);
140140
setOffset(offsetValue + nodes.length);
141141
} catch (err) {
@@ -145,12 +145,12 @@ export default function GroupsViewer({ restApiUrl, setRootNodeId }) {
145145
setLoading(false);
146146
}
147147
},
148-
[restApiUrl, selectedGroups, selectedTypes]
148+
[restApiUrl, selectedGroups, selectedTypes],
149149
);
150150

151151
// auto-fetch initial nodes
152152
useEffect(() => {
153-
if (groups.length > 0 && rawTableData.length === 0) {
153+
if (rawTableData.length === 0) {
154154
fetchNodes(0, 1000);
155155
}
156156
}, [groups, rawTableData.length, fetchNodes]);
@@ -203,7 +203,7 @@ export default function GroupsViewer({ restApiUrl, setRootNodeId }) {
203203
setSelectedGroups((prev) =>
204204
e.target.checked
205205
? [...prev, g.label]
206-
: prev.filter((x) => x !== g.label)
206+
: prev.filter((x) => x !== g.label),
207207
)
208208
}
209209
/>

0 commit comments

Comments
 (0)