Skip to content

[HOLD for payment 2023-08-08] [Performance] Show cached onyx content right away #22644

Closed

Description

@hannojg

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


What performance issue do we need to solve?

We are trying to make Onyx more performant by default. Right now, onyx always starts in a loading state, then collects all the
requested keys and sets them to the component state. This is often times inefficient as all the data is already available in a cache which we can read synchronously.

For exact technical details see: Expensify/react-native-onyx#269

What is the impact of this on end-users?

  • Unnecessary loading states: We often start by default in a loading state, although we could show the content right away. Showing the content directly provides better UX
  • Performance impacts due to a lot of re-renders: Due to this architecture a component re-renders a lot until it reached its final loaded state. This comes with a performance cost creating janky transitions to screens.

List any benchmarks that show the severity of the issue

See: Expensify/react-native-onyx#269

Proposed solution (if any)

See: Expensify/react-native-onyx#269

Once we have the onyx changes in place we need to update onyx in the app and adjust a few screens to work correctly. Some screens are build with the assumption that we will always start in a loading state.
We will start by adjusting the ReportScreen. The following adjustments need to be made (as discussed here):

  • Defer the loading of new chat messages to the next batch, so it doesn’t block the initial rendering by changing a state variable on the report.
  • There was recently a firstRenderRef introduced, which delays the real rendering of the report screen after it has been mounted. We want to get rid of it to show the available content right away.

List any benchmarks after implementing the changes to show impacts of the proposed solution (if any)

See: Expensify/react-native-onyx#269

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: x
Reproducible in staging?: yes
Reproducible in production?: yes
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:
**Issue reported by: @hannojg **
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1688580518417739

Activity

  1. melvin-bot commented on Jul 11, 2023

    @melvin-bot

    Triggered auto assignment to @iwiznia (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

  2. changed the title [-][Performance] Show cached onyx content right awak[/-] [+][Performance] Show cached onyx content right away[/+] on Jul 11, 2023
  3. assigned and unassigned on Jul 11, 2023
  4. iwiznia commented on Jul 11, 2023

    @iwiznia
    Contributor

    @hannojg I assume you want this assigned to you since you'll be working on it, right?

  5. hannojg commented on Jul 12, 2023

    @hannojg
    ContributorAuthor

    Yes, correct, thank you!

  6. hannojg commented on Jul 17, 2023

    @hannojg
    ContributorAuthor
  7. melvin-bot commented on Jul 20, 2023

    @melvin-bot

    @hannojg Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  8. hannojg commented on Jul 24, 2023

    @hannojg
    ContributorAuthor

    This is on hold as the work and discussions are happening here:

  9. melvin-bot commented on Jul 27, 2023

    @melvin-bot

    @hannojg Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  10. 27 remaining items

  11. melvin-bot commented on Aug 6, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  12. mountiny commented on Aug 6, 2023

    @mountiny
    Contributor

    We need to pay $1000 to @mollfpr for their review and testing

  13. added
    Reviewing
    Weekly
    Daily
    and removed
    Daily
    Weekly
    on Aug 7, 2023
  14. slafortune commented on Aug 11, 2023

    @slafortune
    Contributor
  15. slafortune commented on Aug 14, 2023

    @slafortune
    Contributor

    Paid

  16. hannojg commented on Aug 14, 2023

    @hannojg
    ContributorAuthor

    The original PR for this issue was reverted and the new PR can be found here:

    Can we reopen this issue please @slafortune ?e

  17. added
    Weekly
    and removed
    Daily
    on Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugEngineeringReviewingWeekly

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions