Merge branch '18661-refresh-flicker-fix'. Closes #18661
authorLucas Di Pentima <lucas.dipentima@curii.com>
Fri, 4 Feb 2022 22:28:40 +0000 (19:28 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Fri, 4 Feb 2022 22:29:44 +0000 (19:29 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

cypress/integration/side-panel.spec.js
src/components/data-table/data-table.test.tsx
src/components/data-table/data-table.tsx
src/store/project-panel/project-panel-middleware-service.ts
src/store/workbench/workbench-actions.ts
src/views-components/main-content-bar/main-content-bar.tsx

index f9d4dca34014554d954b1c5ddd788393ea65ce05..afe326e39a15166075bbf399a5578c16422b8b6b 100644 (file)
@@ -104,7 +104,7 @@ describe('Side panel tests', function() {
         cy.getAll('@mySharedWritableProject')
             .then(function ([mySharedWritableProject]) {
                 cy.loginAs(activeUser);
-                
+
                 cy.get('[data-cy=side-panel-tree]').contains('Projects').click();
 
                 const newProjectName = `New project name ${mySharedWritableProject.name}`;
@@ -125,19 +125,16 @@ describe('Side panel tests', function() {
             addToFavorites: false
         });
 
-        cy.getAll('@writableProject')
-            .then(function ([writableProject]) {
-                cy.loginAs(activeUser);
-                
-                cy.get('[data-cy=side-panel-tree]').contains('Projects').click();
-
-                cy.get('[data-cy=side-panel-tree]').contains(writableProject.name).should('exist');
-
-                cy.trashGroup(activeUser.token, writableProject.uuid);
-
+        cy.getAll('@writableProject').then(function ([writableProject]) {
+            cy.loginAs(activeUser);
+            cy.get('[data-cy=side-panel-tree]')
+                .contains('Projects').click();
+            cy.get('[data-cy=side-panel-tree]')
+                .contains(writableProject.name).should('exist');
+            cy.trashGroup(activeUser.token, writableProject.uuid).then(() => {
                 cy.contains('Refresh').click();
-
                 cy.contains(writableProject.name).should('not.exist');
             });
+        });
     });
 })
index 85379e9ae9955299218225bf866c690e5e6248a6..866564ac4f25140cbf84f9c4dd8a6dca648cbcd9 100644 (file)
@@ -101,6 +101,7 @@ describe("<DataTable />", () => {
         ];
         const dataTable = mount(<DataTable
             columns={columns}
+            working={false}
             items={["item 1"]}
             onFiltersChange={jest.fn()}
             onRowClick={jest.fn()}
@@ -128,6 +129,7 @@ describe("<DataTable />", () => {
         ];
         const dataTable = mount(<DataTable
             columns={columns}
+            working={false}
             items={["item 1"]}
             onFiltersChange={jest.fn()}
             onRowClick={jest.fn()}
index 2119e53d7df603a91de2da7dfa4f9772403963e4..e8a6ce69aad0cd923f4e3c77d2385e5bb107f526 100644 (file)
@@ -96,16 +96,15 @@ export const DataTable = withStyles(styles)(
                             </TableRow>
                         </TableHead>
                         <TableBody className={classes.tableBody}>
-                            {
-                                this.props.working ?
-                                <div className={classes.loader}>
-                                    <DataTableDefaultView
-                                        icon={PendingIcon}
-                                        messages={['Loading data, please wait.']} />
-                                </div> : items.map(this.renderBodyRow)
-                            }
+                            { this.props.working !== undefined && !this.props.working && items.map(this.renderBodyRow) }
                         </TableBody>
                     </Table>
+                    { this.props.working &&
+                        <div className={classes.loader}>
+                            <DataTableDefaultView
+                                icon={PendingIcon}
+                                messages={['Loading data, please wait.']} />
+                        </div> }
                     {items.length === 0 && this.props.working !== undefined && !this.props.working && this.renderNoItemsPlaceholder()}
                 </div>
             </div>;
index 456508437c9beb10bee2c04fa9cfebc6cdaba6d6..be569b49ff0276aa031f1467aec896d08c32989b 100644 (file)
@@ -50,7 +50,6 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService
             try {
                 api.dispatch(progressIndicatorActions.START_WORKING(this.getId()));
                 const response = await this.services.groupsService.contents(projectUuid, getParams(dataExplorer, !!isProjectTrashed));
-                api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId()));
                 const resourceUuids = response.items.map(item => item.uuid);
                 api.dispatch<any>(updateFavorites(resourceUuids));
                 api.dispatch<any>(updatePublicFavorites(resourceUuids));
index 527d9d74bfe5ec60631774ca24c7aec953ae8527..03d65f62817e120567e3d27152f5f418caddd15b 100644 (file)
@@ -194,35 +194,34 @@ export const loadProject = (uuid: string) =>
         async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
             const userUuid = getUserUuid(getState());
             dispatch(setIsProjectPanelTrashed(false));
-            if (userUuid) {
-                if (extractUuidKind(uuid) === ResourceKind.USER && userUuid !== uuid) {
-                    // Load another users home projects
-                    dispatch(finishLoadingProject(uuid));
-                } else if (userUuid !== uuid) {
-                    const match = await loadGroupContentsResource({ uuid, userUuid, services });
-                    match({
-                        OWNED: async project => {
-                            await dispatch(activateSidePanelTreeItem(uuid));
-                            dispatch<any>(setSidePanelBreadcrumbs(uuid));
-                            dispatch(finishLoadingProject(project));
-                        },
-                        SHARED: project => {
-                            dispatch<any>(setSharedWithMeBreadcrumbs(uuid));
-                            dispatch(activateSidePanelTreeItem(uuid));
-                            dispatch(finishLoadingProject(project));
-                        },
-                        TRASHED: project => {
-                            dispatch<any>(setTrashBreadcrumbs(uuid));
-                            dispatch(setIsProjectPanelTrashed(true));
-                            dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
-                            dispatch(finishLoadingProject(project));
-                        }
-                    });
-                } else {
-                    await dispatch(activateSidePanelTreeItem(userUuid));
-                    dispatch<any>(setSidePanelBreadcrumbs(userUuid));
-                    dispatch(finishLoadingProject(userUuid));
-                }
+            if (!userUuid) {
+                return;
+            }
+            if (extractUuidKind(uuid) === ResourceKind.USER && userUuid !== uuid) {
+                // Load another users home projects
+                dispatch(finishLoadingProject(uuid));
+            } else if (userUuid !== uuid) {
+                await dispatch(finishLoadingProject(uuid));
+                const match = await loadGroupContentsResource({ uuid, userUuid, services });
+                match({
+                    OWNED: async () => {
+                        await dispatch(activateSidePanelTreeItem(uuid));
+                        dispatch<any>(setSidePanelBreadcrumbs(uuid));
+                    },
+                    SHARED: async () => {
+                        await dispatch(activateSidePanelTreeItem(uuid));
+                        dispatch<any>(setSharedWithMeBreadcrumbs(uuid));
+                    },
+                    TRASHED: async () => {
+                        await dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
+                        dispatch<any>(setTrashBreadcrumbs(uuid));
+                        dispatch(setIsProjectPanelTrashed(true));
+                    }
+                });
+            } else {
+                await dispatch(finishLoadingProject(userUuid));
+                await dispatch(activateSidePanelTreeItem(userUuid));
+                dispatch<any>(setSidePanelBreadcrumbs(userUuid));
             }
         });
 
index 480150cb45daec040f12d05d27f3ccc3043cfdf6..a460a51800c7d00ee929a82258a6e9a8eea2c3fa 100644 (file)
@@ -12,7 +12,6 @@ import { RootState } from 'store/store';
 import * as Routes from 'routes/routes';
 import { toggleDetailsPanel } from 'store/details-panel/details-panel-action';
 import RefreshButton from "components/refresh-button/refresh-button";
-import { reloadProjectMatchingUuid } from "store/workbench/workbench-actions";
 import { loadSidePanelTreeProjects } from "store/side-panel-tree/side-panel-tree-actions";
 
 type CssRules = "infoTooltip";
@@ -63,7 +62,6 @@ export const MainContentBar =
             onDetailsPanelToggle: () => dispatch<any>(toggleDetailsPanel()),
             onRefreshButtonClick: (id) => {
                 dispatch<any>(loadSidePanelTreeProjects(id));
-                dispatch<any>(reloadProjectMatchingUuid([id]));
             }
         }))(
             withStyles(styles)(