Skip to content

Commit

Permalink
Provide default object for destructuring location state
Browse files Browse the repository at this point in the history
  • Loading branch information
HelNershingThapa committed Jun 1, 2022
1 parent f3f1b69 commit 096f825
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/src/components/taskSelection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function TaskSelection({ project, type, loading }: Object) {
}, []);

useEffect(() => {
const { lastLockedTasksIds, lastLockedProjectId } = location.state;
const { lastLockedTasksIds, lastLockedProjectId } = location.state || {};
if (lastLockedTasksIds && lastLockedProjectId === project.projectId) {
setZoomedTaskId(lastLockedTasksIds);
}
Expand Down

1 comment on commit 096f825

@HelNershingThapa
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The app broke if the user routed directly from the URL to the task selection page. Providing a default empty object would fix it.

Please sign in to comment.