Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TaskDialog] - Fix for JSForm getting cleard when store update #1254

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

marcus-oscarsson
Copy link
Member

This fixes a few issues with the generic task dialog.

  • The "current" values of the JSForm is saved in local storage so that they are not cleared by updates to the redux store (as the redux form gets re-rendered when the store is updated)

  • Reset to default fixed

  • Added missing title

@@ -43,6 +43,17 @@ class GenericTaskForm extends React.Component {
this.props.handleSubmit(this.addToQueue.bind(this, true))();
}

clearCurrentJSFormParameters() {
localStorage.removeItem(`current${this.props.taskData.type}Parameters`);
Copy link
Contributor

Choose a reason for hiding this comment

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

You could make a getter for the local storage key instead — it's the logic that is worth abstracting IMO.

get storageKey() {
  return `current${this.props.taskData.type}Parameters`;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh thats nice :)

@@ -167,6 +183,18 @@ class GenericTaskForm extends React.Component {
}
}

const currentFormData = JSON.parse(
localStorage.getItem(`current${this.props.taskData.type}Parameters`),
Copy link
Contributor

Choose a reason for hiding this comment

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

this.jsFormStorageKey

show={this.props.show}
onHide={() => {
localStorage.removeItem(
`current${this.props.taskData.type}Parameters`,
Copy link
Contributor

Choose a reason for hiding this comment

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

this.jsFormStorageKey

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, thanks :)

@marcus-oscarsson marcus-oscarsson merged commit 46ce4b3 into develop Jun 21, 2024
13 checks passed
@marcus-oscarsson marcus-oscarsson deleted the mo-task-dialog branch June 21, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants