-
Notifications
You must be signed in to change notification settings - Fork 37
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
Conversation
fb96504
to
b3b0464
Compare
@@ -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`); |
There was a problem hiding this comment.
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`;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh thats nice :)
b3b0464
to
f739d74
Compare
@@ -167,6 +183,18 @@ class GenericTaskForm extends React.Component { | |||
} | |||
} | |||
|
|||
const currentFormData = JSON.parse( | |||
localStorage.getItem(`current${this.props.taskData.type}Parameters`), |
There was a problem hiding this comment.
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`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.jsFormStorageKey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, thanks :)
f739d74
to
b243201
Compare
b243201
to
f1bf940
Compare
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