MM-13432 Remove unused _REQUEST, _SUCCESS and _FAILURE actions #748
Conversation
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 is terrific! Fully agree with the summary as well: do we want to raise this at the next developer's meeting and capture this pattern going forward?
@@ -62,29 +62,37 @@ export function requestFailure(type: ActionType, error: Client4Error) { | |||
* @param {...Array<any>} args | |||
* @returns {ActionFunc} ActionFunc | |||
*/ | |||
export function bindClientFunc(clientFunc: () => Promise<mixed>, request: ActionType, | |||
success: ActionType | Array<ActionType>, failure: ActionType, ...args: Array<any>): ActionFunc { | |||
export function bindClientFunc({ |
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.
Should we update the @param
comments here? Do we need to capture any flow types?
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 yes, I will update the params here. I need to push another commit as i saw few unused flags in mobile repo. So will be removing them and updating this PR along with it.
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.
@lieut-data done 👍 Have a look at the flow commit changes. Let me know if you have any comments
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.
Aah forgot to change the comment of @param here :(
@sudheerDev is this ready for review? |
@jwilander Forgot to change the label back. It is up for review |
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.
Awesome. Only question I have is: the mobile app uses the request state in some cases, will merging this require changes in the mobile app to address that?
Yes both mobile and webapp do still use few flags. There is a related mobile PR in i removed few unused status flags so, i removed them as well and removed them from redux files in the last commit here. Rest of the flags left here in the PR for the files above are being used and luckily they are not all that frequent actions. |
* Remove request status from posts * Remove request status from channels * Remove request status from teams * Remove request status from files * Remove emojis requests * Change bindClientFunc to accept obj instead or arguments
…rmost#748) * MM-13432 Eliminate _REQUEST, _SUCCESS and _FAILURE actions * Remove request status from posts * Remove request status from channels * Remove request status from teams * Remove request status from files * Remove emojis requests * Change bindClientFunc to accept obj instead or arguments * Fix flow errors * Remove unused mobile repo state flags * Update jsdoc annotations for client helper func * Fix rebase issue
Summary
This PR removes any unused status states and requests from the following entities
Channels
Posts
teams
Users
Files
Emoji
This is part of the performance improvement for channel switch/ postList mount and update. PR does not completely remove all of the request entities as most of the flags left does not impact the performance for the channel switch. Moreover moving away from storing flags might not be al that possible and needed in few cases so, we might have to circle back again to a similar pattern. Moving the flags to react components can cause problems as state is lost when a component is unmounted.
Going forward we have to make sure that we don't introduce these state flags for request if we don't use
Ticket Link
MM-13544
related mobile PR: mattermost/mattermost-mobile#2490
Checklist
[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]
make check-style
to check for style errors (required for all pull requests)make test
to ensure unit tests passedmake flow
to ensure type checking passed