From be33bc8c17b2e12b96d176d16e60f8ebe3fe1c06 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Tue, 9 May 2023 15:39:16 -0400 Subject: [PATCH] 20487: loadProject doesn't call openProjectPanel The bug was was that loading the registered workflow panel would call loadProject() which would call openProjectPanel() which would dispatch REQUEST_ITEMS for the project (which is 100% wasteful, because we're not displaying the project contents). However, the results from REQUEST_ITEMS (which excludes some fields in the standard query) would replace the result that previously got the complete workflow object. As a result the "definition" field went away, which cause the inputs/outputs panels to go blank. This switches the navigation action to call "openProjectPanel", and have that begin by calling "loadProject". As a result, other places that call loadProject no longer call openProjectPanel. Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- package.json | 1 + src/routes/route-change-handlers.ts | 3 ++- src/store/project-panel/project-panel-action.ts | 4 +++- src/store/store.ts | 14 ++------------ src/store/workbench/workbench-actions.ts | 2 -- yarn.lock | 10 ++++++++++ 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index c17fc917..0a10da78 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "react-virtualized-auto-sizer": "1.0.2", "react-window": "1.8.5", "redux": "4.0.3", + "redux-devtools-extension": "^2.13.9", "redux-form": "7.4.2", "redux-thunk": "2.3.0", "reselect": "4.0.0", diff --git a/src/routes/route-change-handlers.ts b/src/routes/route-change-handlers.ts index cded6d65..eef52058 100644 --- a/src/routes/route-change-handlers.ts +++ b/src/routes/route-change-handlers.ts @@ -11,6 +11,7 @@ import { dialogActions } from 'store/dialog/dialog-actions'; import { contextMenuActions } from 'store/context-menu/context-menu-actions'; import { searchBarActions } from 'store/search-bar/search-bar-actions'; import { pluginConfig } from 'plugins'; +import { openProjectPanel } from 'store/project-panel/project-panel-action'; export const addRouteChangeHandlers = (history: History, store: RootStore) => { const handler = handleLocationChange(store); @@ -60,7 +61,7 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { } if (projectMatch) { - store.dispatch(WorkbenchActions.loadProject(projectMatch.params.id)); + store.dispatch(openProjectPanel(projectMatch.params.id)); } else if (collectionMatch) { store.dispatch(WorkbenchActions.loadCollection(collectionMatch.params.id)); } else if (favoriteMatch) { diff --git a/src/store/project-panel/project-panel-action.ts b/src/store/project-panel/project-panel-action.ts index 3b30f4aa..6b99e300 100644 --- a/src/store/project-panel/project-panel-action.ts +++ b/src/store/project-panel/project-panel-action.ts @@ -7,6 +7,7 @@ import { bindDataExplorerActions } from "store/data-explorer/data-explorer-actio import { propertiesActions } from "store/properties/properties-actions"; import { RootState } from 'store/store'; import { getProperty } from "store/properties/properties"; +import { loadProject } from "store/workbench/workbench-actions"; export const PROJECT_PANEL_ID = "projectPanel"; export const PROJECT_PANEL_CURRENT_UUID = "projectPanelCurrentUuid"; @@ -14,7 +15,8 @@ export const IS_PROJECT_PANEL_TRASHED = 'isProjectPanelTrashed'; export const projectPanelActions = bindDataExplorerActions(PROJECT_PANEL_ID); export const openProjectPanel = (projectUuid: string) => - (dispatch: Dispatch) => { + async (dispatch: Dispatch) => { + await loadProject(projectUuid); dispatch(propertiesActions.SET_PROPERTY({ key: PROJECT_PANEL_CURRENT_UUID, value: projectUuid })); dispatch(projectPanelActions.RESET_EXPLORER_SEARCH_VALUE()); dispatch(projectPanelActions.REQUEST_ITEMS()); diff --git a/src/store/store.ts b/src/store/store.ts index 1501fd4f..ec673d62 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -77,17 +77,7 @@ import { MiddlewareListReducer } from 'common/plugintypes'; import { tooltipsMiddleware } from './tooltips/tooltips-middleware'; import { sidePanelReducer } from './side-panel/side-panel-reducer' import { bannerReducer } from './banner/banner-reducer'; - -declare global { - interface Window { - __REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: typeof compose; - } -} - -const composeEnhancers = - (process.env.NODE_ENV === 'development' && - window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || - compose; +import { composeWithDevTools } from 'redux-devtools-extension'; export type RootState = ReturnType>; @@ -187,7 +177,7 @@ export function configureStore(history: History, services: ServiceRepository, co middlewares = pluginConfig.middlewares.reduce(reduceMiddlewaresFn, middlewares); - const enhancer = composeEnhancers(applyMiddleware(redirectToMiddleware, ...middlewares)); + const enhancer = composeWithDevTools({/* options */ })(applyMiddleware(redirectToMiddleware, ...middlewares)); return createStore(rootReducer, enhancer); } diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts index 52433779..a3c3a096 100644 --- a/src/store/workbench/workbench-actions.ts +++ b/src/store/workbench/workbench-actions.ts @@ -13,7 +13,6 @@ import { } from 'store/favorite-panel/favorite-panel-action'; import { getProjectPanelCurrentUuid, - openProjectPanel, projectPanelActions, setIsProjectPanelTrashed, } from 'store/project-panel/project-panel-action'; @@ -866,7 +865,6 @@ const finishLoadingProject = (project: GroupContentsResource | string) => async (dispatch: Dispatch) => { const uuid = typeof project === 'string' ? project : project.uuid; - dispatch(openProjectPanel(uuid)); dispatch(loadDetailsPanel(uuid)); if (typeof project !== 'string') { dispatch(updateResources([project])); diff --git a/yarn.lock b/yarn.lock index 580aa8ed..e96e7751 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3811,6 +3811,7 @@ __metadata: react-window: 1.8.5 redux: 4.0.3 redux-devtools: 3.4.1 + redux-devtools-extension: ^2.13.9 redux-form: 7.4.2 redux-mock-store: 1.5.4 redux-thunk: 2.3.0 @@ -15448,6 +15449,15 @@ __metadata: languageName: node linkType: hard +"redux-devtools-extension@npm:^2.13.9": + version: 2.13.9 + resolution: "redux-devtools-extension@npm:2.13.9" + peerDependencies: + redux: ^3.1.0 || ^4.0.0 + checksum: 603d48fd6acf3922ef373b251ab3fdbb990035e90284191047b29d25b06ea18122bc4ef01e0704ccae495acb27ab5e47b560937e98213605dd88299470025db9 + languageName: node + linkType: hard + "redux-devtools-instrument@npm:^1.0.1": version: 1.10.0 resolution: "redux-devtools-instrument@npm:1.10.0" -- 2.30.2