-
Notifications
You must be signed in to change notification settings - Fork 55
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
fix(containers/DeleteRessource): fix behaviour when refreshing browser #1053
Conversation
output/containers.eslint.txt
Outdated
> eslint --config ../../.eslintrc src | ||
|
||
The react/require-extension rule is deprecated. Please use the import/extensions rule from eslint-plugin-import instead. | ||
|
||
/home/travis/build/Talend/ui/packages/containers/src/ActionSplitDropdown/ActionSplitDropdown.test.js | ||
4:10 error 'ActionSplitDropdown' is defined but never used no-unused-vars | ||
|
||
/home/travis/build/Talend/ui/packages/containers/src/DeleteResource/DeleteResource.test.js | ||
4:15 error 'List' is defined but never used no-unused-vars |
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.
OMG !
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.
Oops
return {}; | ||
} | ||
|
||
export default cmfConnect({ componentId: 'DeleteResource', mapStateToProps })(Container); |
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.
componentId: 'DeleteResource' => componentId: ownProps => ownProps.id || ownProps.componentId
Right now the componentId is hardcoded.
getLabel() { | ||
return this.props.resource | ||
? { label: this.props.resource.get('label'), found: true } | ||
: { label: '', found: false }; | ||
} |
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.
return {
label: this.props.resource.get('label', '')
found: !!resource
}
what do u think ?
try { | ||
yield race({ | ||
deleteConfirmationValidate: call( | ||
deleteResourceValidate, | ||
uri, | ||
resourceType, | ||
id, | ||
routerParams.id, |
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.
problem i see here is how to handle routes where the the resource indentifier is not strictly called id
, how to deal with nested routes if we force all resources identifier to be called id
example connection/:id/dataset/:id
with a delete at the end ?
couldn't on reload check the existence of the collection inside the sagas ? maybe wait or maybe immediatly redirect ? from the saga |
resourceType, | ||
resourcePath, | ||
redirectUrl, | ||
routerParamsAttribute, |
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.
missing in docblock
missing on doc, maybe we should handle a default value ?
or runtime check the parameters ?
What is the problem this PR is trying to solve?
When we refresh the browser, the desired collection to populate the modal is not always there.
Also, when we refresh the browser, some event needed on saga start are not dispatched
What is the chosen solution to this problem?
change function done in render to mapStateToProps to watch the redux change state & re-evaluate the searched resource
remove the needed event to start the saga. We got the id & the url to redirect with this action catched, so one part is declared in the saga declaration on the sagaRouter, the other part ( id ) is get on routerParams
Please check if the PR fulfills these requirements
[x] This PR introduces a breaking change