Skip to content

Commit

Permalink
fix editing challenge reverting recommended layout to empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak committed Oct 15, 2023
1 parent 5ac09c7 commit daa376f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/WidgetWorkspace/WidgetWorkspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class WidgetWorkspace extends Component {
componentDidUpdate() {
if(!this.state.activeRecommendedLayout && this.props.task?.parent?.widgetLayout) {
const { task, workspaceConfigurations, saveWorkspaceConfiguration } = this.props;
let recommendedLayout = task.parent.widgetLayout
let recommendedLayout = task.parent.widgetLayout.workspace

if (this.props.workspaceConfigurations?.recommendedLayout) {
this.props.deleteWorkspaceConfiguration(this.props.workspaceConfigurations.recommendedLayout.id)
Expand Down
4 changes: 2 additions & 2 deletions src/services/Challenge/Challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -963,12 +963,12 @@ export const fetchChallenges = function (

// If there is local GeoJSON content being transmitted as a string, parse
// it into JSON first.
if (challengeData.widgetLayout) {
if (!challengeData.widgetLayout.workspace && challengeData.widgetLayout) {
try {
if (!JSON.parse(challengeData.widgetLayout).workspace) {
throw new Error("Widget layout with the wrong format was submitted, it was not included in the save.")
}
challengeData.widgetLayout = JSON.parse(challengeData.widgetLayout).workspace
challengeData.widgetLayout = JSON.parse(challengeData.widgetLayout)
} catch(error) {
challengeData.widgetLayout = "";
console.error(error);
Expand Down

0 comments on commit daa376f

Please sign in to comment.