X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c0f97a0f0617e1b6d2da1ab0e256a226b8ed810a..0eea0b8a51ffec0c7e975932c029e4bd9a1d6b7e:/services/workbench2/src/components/data-table/data-table.tsx

diff --git a/services/workbench2/src/components/data-table/data-table.tsx b/services/workbench2/src/components/data-table/data-table.tsx
index 9393fd2f92..ae05353b4c 100644
--- a/services/workbench2/src/components/data-table/data-table.tsx
+++ b/services/workbench2/src/components/data-table/data-table.tsx
@@ -159,6 +159,12 @@ export const DataTable = withStyles(styles)(
 
         componentDidMount(): void {
             this.initializeCheckedList([]);
+            // If table is initialized loaded but empty
+            // isLoaded won't be set true by componentDidUpdate later
+            // So we set it to true here
+            if (!this.props.working) {
+                this.setState({ isLoaded: true });
+            }
         }
 
         componentDidUpdate(prevProps: Readonly<DataTableProps<T>>, prevState: DataTableState) {
@@ -171,7 +177,7 @@ export const DataTable = withStyles(styles)(
                 else setCheckedListOnStore({});
             }
             if (prevProps.currentRoute !== this.props.currentRoute) {
-                this.initializeCheckedList([])
+                this.initializeCheckedList([]);
             }
             if (singleSelected && singleSelected !== isExactlyOneSelected(prevProps.checkedList)) {
                 this.props.setSelectedUuid(singleSelected);
@@ -191,7 +197,7 @@ export const DataTable = withStyles(styles)(
         }
 
         componentWillUnmount(): void {
-            this.initializeCheckedList([])
+            this.initializeCheckedList([]);
         }
 
         checkBoxColumn: DataColumn<any, any> = {
@@ -311,7 +317,7 @@ export const DataTable = withStyles(styles)(
         render() {
             const { items, classes, columns, isNotFound } = this.props;
             const { isLoaded } = this.state;
-            if (columns[0].name === this.checkBoxColumn.name) columns.shift();
+            if (columns.length && columns[0].name === this.checkBoxColumn.name) columns.shift();
             columns.unshift(this.checkBoxColumn);
             return (
                 <div className={classes.root}>
@@ -334,17 +340,17 @@ export const DataTable = withStyles(styles)(
             const dirty = columns.some(column => getTreeDirty("")(column.filters));
             if (isNotFound && isLoaded) {
                 return (
-                    <DataTableDefaultView 
-                        icon={this.props.defaultViewIcon} 
-                        messages={["No items found"]} 
+                    <DataTableDefaultView
+                        icon={this.props.defaultViewIcon}
+                        messages={["No items found"]}
                     />
                 );
-            } else 
+            } else
             if (isLoaded === false || working === true) {
                 return (
-                    <DataTableDefaultView 
-                        icon={PendingIcon} 
-                        messages={["Loading data, please wait"]} 
+                    <DataTableDefaultView
+                        icon={PendingIcon}
+                        messages={["Loading data, please wait"]}
                     />
                 );
             } else {
