Skip to content

fix: infinite loaders in report section#56819

Merged
mountiny merged 9 commits intoExpensify:mainfrom
callstack-internal:fix-infinite-loader
Feb 26, 2025
Merged

fix: infinite loaders in report section#56819
mountiny merged 9 commits intoExpensify:mainfrom
callstack-internal:fix-infinite-loader

Conversation

@martasudol
Copy link
Contributor

@martasudol martasudol commented Feb 13, 2025

Explanation of Change

Removed Onyx flags conditions in ReportScreen.tsx as they were causing infinite loaders.

Fixed Issues

$ #57174
PROPOSAL: https://expensify.slack.com/archives/C05LX9D6E07/p1739443969065029

Tests

  1. Open any report
  2. Skeleton loader should visible while messages are being fetched
  3. Skeleton loader should disappear once data is loaded and be replaced with report actions.
  4. If there is no data fetched, there should be empty state component with "No activity yet" information.
  • Verify that no errors appear in the JS console

Offline tests

Same as Tests

QA Steps

Same as tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native https://github.com/user-attachments/assets/f24ae938-86de-47c8-880d-7b85a46d2e2a
Android: mWeb Chrome https://github.com/user-attachments/assets/0083dc70-37d5-4ae8-a4cd-76c1520a09e7
iOS: Native https://github.com/user-attachments/assets/9a1a714c-9059-4d24-8fee-cfa7fb99fa14
iOS: mWeb Safari https://github.com/user-attachments/assets/db45fe4e-8fd2-42e1-87d4-e8d9d60939f7
MacOS: Chrome / Safari https://github.com/user-attachments/assets/9d156da8-6085-4ac2-a9d4-a9f4cbd92558
MacOS: Desktop https://github.com/user-attachments/assets/2b3d3f66-b770-48e8-8a4b-02d0b121af67

@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@martasudol
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

CLABotify added a commit to Expensify/CLA that referenced this pull request Feb 13, 2025
@martasudol martasudol marked this pull request as ready for review February 20, 2025 11:05
@martasudol martasudol requested a review from a team as a code owner February 20, 2025 11:05
@melvin-bot melvin-bot bot requested a review from akinwale February 20, 2025 11:05
@melvin-bot
Copy link

melvin-bot bot commented Feb 20, 2025

@akinwale Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot removed the request for review from a team February 20, 2025 11:05
@mountiny mountiny requested review from fedirjh and removed request for adhorodyski and akinwale February 20, 2025 12:36
@mountiny
Copy link
Contributor

@fedirjh is assigned in the issue

@mountiny
Copy link
Contributor

@martasudol can you make sure to test deeplinks to reports you have not opened before? Also deeplink to a report action further in a history of the chat where we need to load the surrounding report actions. Thank you!

@martasudol
Copy link
Contributor Author

martasudol commented Feb 21, 2025

@martasudol can you make sure to test deeplinks to reports you have not opened before? Also deeplink to a report action further in a history of the chat where we need to load the surrounding report actions. Thank you!

@mountiny I've just finished testing it. Works for both reports I have not opened before and report action further in a history of the chat. 🤞

@fedirjh
Copy link
Contributor

fedirjh commented Feb 24, 2025

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native
CleanShot.2025-02-25.at.19.17.12.mp4
Android: mWeb Chrome
CleanShot.2025-02-25.at.19.26.51.mp4
iOS: Native
CleanShot.2025-02-25.at.19.03.46.mp4
Screenshot 2025-02-25 at 7 06 41 PM
iOS: mWeb Safari
CleanShot.2025-02-25.at.13.50.30.mp4
MacOS: Chrome / Safari
CleanShot.2025-02-25.at.13.19.10.mp4
MacOS: Desktop
CleanShot.2025-02-25.at.19.40.46.mp4

@fedirjh
Copy link
Contributor

fedirjh commented Feb 24, 2025

@martasudol Skeleton isn’t displayed when I switch between reports

CleanShot 2025-02-24 at 12 15 40

@adhorodyski
Copy link
Contributor

-315 LOCs working while more correct & snappy, love it!

@martasudol
Copy link
Contributor Author

Skeleton isn’t displayed when I switch between reports

@fedirjh thanks for your feedback!
This implementation works as following:

  1. Skeleton loader shows only when there are no actions loaded yet and we're waiting for server response
  2. When at least 1 action is already loaded (like in your case from recording), we show the last loaded message and we do not show skeleton.

Our plan is to improve loading state perception (including less "blinking" skeletons and loading bars when data is already present) in a separate task (so your case will be handled in "improve perception" ticket'; as a next step of improvements and it will be addressed by loading bar).

@mountiny let us know what's your preference - should we stick with our plan to address this in the upcoming task, or would you prefer we address it here as well.

@mountiny
Copy link
Contributor

I dont think its blocker personally if we follow up in making the feedback even better, but I agree that the empty blank page there is also not looking great.

Curious if @Expensify/design thinks its ok to move with this step first and then follow up with improvement or if we should try to bundle it all together to one big PR (however that increases changes or regressions and need to potentially revert)

@martasudol
Copy link
Contributor Author

martasudol commented Feb 26, 2025

@fedirjh thank you so much for your review and noticing these issues! I've already pushed fixes so feel free to test it again.

Current behavior for online status after clearing cache:

clear_cache_online.mov

Current behavior for offline status:

offline.mov

@fedirjh
Copy link
Contributor

fedirjh commented Feb 26, 2025

@martasudol Thank you for the addressing the bugs. I confirm that both bugs are fixed for me 🚀

@mountiny
Copy link
Contributor

@fedirjh is this ready to go from your perspective

Copy link
Contributor

@fedirjh fedirjh left a comment

Choose a reason for hiding this comment

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

is this ready to go from your perspective

@mountiny Yep, let's move forward :shipit:

@melvin-bot melvin-bot bot requested a review from mountiny February 26, 2025 22:01
Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

Thanks @fedirjh @martasudol Changes look good to me but I am afraid there will be blockers from this as the code is complex and things can break here in many spots.

Please be ready to raise a revert if there is more blockers - better to revert and fix it slowly than rushing for fixed @martasudol

I have limitted availability in coming days so also it will help the deployer if you are ready for it

@mountiny mountiny merged commit 3b198df into Expensify:main Feb 26, 2025
17 checks passed
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@adhorodyski
Copy link
Contributor

@mountiny we're expecting the same, hope we can just get this in place with as little number of iterations as possible 😅

@github-actions
Copy link
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.1.7-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 success ✅
🍎🔄 iOS HybridApp 🍎🔄 success ✅

@MariaHCD
Copy link
Contributor

MariaHCD commented Mar 3, 2025

Hey, team! We have an issue on HybridApp where "No activity yet" is displayed briefly when opening room notification. I wonder if this might be related to this PR

Here's the issue: #57585

Could you take a look @martasudol @fedirjh @adhorodyski ? Thanks!

@adhorodyski
Copy link
Contributor

Hey @MariaHCD, thanks for letting us know. I think it is related, we fixed the same quick flash for other scenarios before and it definitely should only hit the loading skeleton and then content.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2025

🚀 Deployed to production by https://github.com/puneetlath in version: 9.1.7-2 🚀

platform result
🤖 android 🤖 true ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 failure ❌
🍎🔄 iOS HybridApp 🍎🔄 failure ❌

// There should be only one openReport execution per page start or navigating
fetchReport();
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [route, isLinkedMessagePageReady, isLoadingReportOnyx, reportActionIDFromRoute]);
Copy link
Contributor

Choose a reason for hiding this comment

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

This accidentally introduces an edge case here. More details in this comment

if (
!force &&
(!!network.isOffline ||
isLoadingOlderReportActions ||
Copy link
Contributor

@FitseTLT FitseTLT Jul 10, 2025

Choose a reason for hiding this comment

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

We removed a code here that avoids making more getOlderActions requests before the previous request is resolved. So it is causing this issue of making Multiple API calls for GetOlderActions. So I am proposing to avoid making GetOlderActions when the report meta data is isLoadingOlderReportActions is true here So we wanted to make sure that wouldn't have a negative impact here. So @martasudol is there any specific reason you removed this condition here? Thanks in advance.

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.