Skip to content

Commit

Permalink
Add error handling for the taskMap widget and fix pauseKeywords issue
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak committed Sep 13, 2023
1 parent e769724 commit 84d9720
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/components/Widgets/TaskMapWidget/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ export default defineMessages({
id: "Widgets.TaskMapWidget.editMode",
defaultMessage: "Current Mode:",
},

rapidFailed: {
id: "Widgets.TaskMapWidget.rapidFailed",
defaultMessage: "Widget Failed! Geometries Null!",
},
})
15 changes: 15 additions & 0 deletions src/components/Widgets/TaskMapWidget/TaskMapWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ export default class TaskMapWidget extends Component {
render() {
const editMode = this.props.getUserAppSetting ? this.props.getUserAppSetting(this.props.user, 'isEditMode') : false;

if(!this.props.task.geometries.features){
return (
<QuickWidget
{...this.props}
className="task-map-widget"
noMain
permanent
>
<div className="mr-text-lg mr-text-red-light mr-flex">
<FormattedMessage {...messages.rapidFailed} />
</div>
</QuickWidget>
)
}

return (
<QuickWidget
{...this.props}
Expand Down
2 changes: 1 addition & 1 deletion src/services/KeyboardShortcuts/KeyboardShortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const currentKeyboardShortcuts = function(state={}, action) {
}
else if (action.type === PAUSE_KEYBOARD_SHORTCUTS) {
// If we're already paused, ignore
if (!_isEmpty(state.paused)) {
if (state.paused) {
return state
}

Expand Down

0 comments on commit 84d9720

Please sign in to comment.