Skip to content

Commit

Permalink
fix: do not request current dashboard when NEW route (#1655)
Browse files Browse the repository at this point in the history
The route handler was unnecessarily fetching the current dashboard again before displaying Edit mode.

Note that with the current solution, the visualizations property in the redux store will contain the visualizations of the dashboard that was active before going to NEW, as well as any visualizations that get added to the new dashboard. This won't have any impact on the app. In past versions, visualizations were never cleared from redux so that property potentially had visualizations for many dashboards. Now, visualizations are cleared whenever user switches dashboard with the chips.

This process is up for refactoring at the next opportunity. For now, the current fix should do the job of removing the unnecessary api request.
  • Loading branch information
jenniferarnesen authored Mar 17, 2021
1 parent 66c7504 commit b31124a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const Dashboard = ({
}, [mode])

useEffect(() => {
if (dashboardsLoaded && !dashboardsIsEmpty) {
if (dashboardsLoaded && !dashboardsIsEmpty && mode !== NEW) {
selectDashboard(routeId, mode)
}
}, [dashboardsLoaded, dashboardsIsEmpty, routeId, mode])
Expand Down

0 comments on commit b31124a

Please sign in to comment.