Skip to content

[HOLD] Reduce iOS slowness by removing draftComment subscription #3169

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

Closed
wants to merge 3 commits into from

Conversation

Jag96
Copy link
Contributor

@Jag96 Jag96 commented May 26, 2021

@marcaaron @yuwenmemon will you please review?

Details

This PR removes a subscription that was making it slower to load chats on iOS. Note: This breaks the draftComment feature, so a fix will have to be implemented to re-introduce that. More context in this issue: #3167 (comment)

Fixed Issues

Fixes #3167

Tests

Note this is much more noticeable on a physical device than it is on simulator

  1. Open cash app in IOS
  2. Navigate to a conversation
  3. Navigate back to LHN
  4. Navigate back to the same conversation, confirm the spinner doesn't block the UI for 5-10 seconds

QA Steps

  1. Open cash app in IOS
  2. Navigate to a conversation
  3. Navigate back to LHN
  4. Navigate back to the same conversation, confirm the spinner doesn't block the UI for 5-10 seconds

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

@Jag96 Jag96 requested review from yuwenmemon and marcaaron May 26, 2021 23:11
@Jag96 Jag96 requested a review from a team as a code owner May 26, 2021 23:11
@Jag96 Jag96 self-assigned this May 26, 2021
@MelvinBot MelvinBot requested review from HorusGoul and removed request for a team and HorusGoul May 26, 2021 23:12

export default withOnyx({
draftMessage: {
key: ({reportID, action}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${reportID}_${action.reportActionID}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

@yuwenmemon I'm not sure if this would improve things much but we could try subscribing to all the drafts just once in ReportActionsView under the key

draftMessages: {
    key: ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS,
},

then pass the draftMessage as a prop like

const key = `${${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${reportID}_${reportActionID}}`;
const draftMessage = this.props.draftMessages[key];

... 

<ReportActionItem
    draftMessage={draftMessage}
    ...
/>

Not sure if this would have any bad effects while in edit mode, but might be something to try.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just tested on my physical device and confirmed that on this branch with the above changes it takes quite a while after tapping edit comment for the UI to let you edit the comment, whereas on main it lets you edit immediately

@yuwenmemon
Copy link
Contributor

@marcaaron I added the suggestion to this branch and edit comments are working well! Decided to push it up since we still keep @Jag96's edits intact so I'm sort of confident this should work.

I've been riding the struggle bus on being able to test this on a device though.

@Jag96
Copy link
Contributor Author

Jag96 commented Jun 1, 2021

I've been riding the struggle bus on being able to test this on a device though.

Is there a specific error you're seeing?

@yuwenmemon
Copy link
Contributor

Essentially what I reported here: https://expensify.slack.com/archives/C03TQ48KC/p1622245982490700

I tried what Scott suggested, no dice :(

@Jag96
Copy link
Contributor Author

Jag96 commented Jun 1, 2021

Posted in the slack thread, we can sort it out there 👍

@Jag96
Copy link
Contributor Author

Jag96 commented Jun 2, 2021

It looks like with the most recent changes to re-enable the draftComment functionality, there is another regression that causes the edit comment UI to take quite a while to show. We're going to hold off on this PR to see if the Onyx Cache updates will help w/ the overall slowness, and come back to it if there are still issues.

@Jag96 Jag96 changed the title Reduce iOS slowness by removing draftComment subscription [HOLD] Reduce iOS slowness by removing draftComment subscription Jun 2, 2021
@Jag96
Copy link
Contributor Author

Jag96 commented Jun 9, 2021

Going to close this since this PR doesn't fix any issues without creating a regression and the onyx PR seems to have sped things up. If we want to optimize onyx subscriptions we can discuss in an issue.

@Jag96 Jag96 closed this Jun 9, 2021
@Jag96 Jag96 deleted the joe-reduce-subscriptions branch June 9, 2021 01:55
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.

iOS - App is extremely slow to load conversations
3 participants