Skip to content

Commit

Permalink
Fixed error when removing notebook with only open cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
mchami02 committed Aug 26, 2024
1 parent daccbb8 commit 8209a8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cluster_viz",
"version": "0.2.1",
"version": "0.2.2",
"description": "Show a random NASA Astronomy Picture of the Day in a JupyterLab panel",
"keywords": [
"jupyter",
Expand Down
5 changes: 3 additions & 2 deletions src/VizComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ const GroupedCells: React.FC<GroupedCellsProps> = ({ className, cells, onSelectN
if (!acc[cell.cluster]) {
acc[cell.cluster] = [];
}
acc[cell.cluster].push(cell);
acc[cell.cluster].push(cell);
return acc;
}, {} as { [key: string]: NotebookCellWithID[] });

const totalCells = cells.length; // Total number of cells within the class

const selectedCells = (clusterNames: string[]) => {
return clusterNames.flatMap((clusterName) =>
return clusterNames.filter(c => c in clusters).flatMap((clusterName) =>
clusters[clusterName].map(cell => ({ clusterName, cell }))
).sort((a, b) => {
if (a.cell.notebook_id === b.cell.notebook_id) {
Expand All @@ -63,6 +63,7 @@ const GroupedCells: React.FC<GroupedCellsProps> = ({ className, cells, onSelectN
return a.cell.notebook_id - b.cell.notebook_id;
});
};

const handleClusterClick = (clusterName: string) => {
setOpenClusters((prev) =>
prev.includes(clusterName) ? prev.filter((name) => name !== clusterName) : [...prev, clusterName]
Expand Down

0 comments on commit 8209a8f

Please sign in to comment.