Skip to content
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 the new message button doesn't work on some comment linkings #46627

Merged
merged 17 commits into from
Aug 12, 2024

Conversation

tsa321
Copy link
Contributor

@tsa321 tsa321 commented Aug 1, 2024

Details

Fixed Issues

$ #45004
PROPOSAL: #45004 (comment)

Tests

  1. Go to a chat with 200 - 210 messages
  2. Copy the link of the 70th comment and send it
  3. Copy the link of the 140th comment and send it
  4. Go to troubleshoot and clear cache and restart
  5. Click on the first link sent on step 2
  6. Click on the "New message" badge that appeared at the top of the chat
  7. Confirm the page scrolls to the bottom of the comment history
  8. Click on the second link sent on step 3.
  9. Click on the "New message" badge once again
  10. Confirm the page scrolls to the bottom of the comment history
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  1. Go to a chat with 200 - 210 messages
  2. Copy the link of the 70th comment and send it
  3. Copy the link of the 140th comment and send it
  4. Go to troubleshoot and clear cache and restart
  5. Click on the first link sent on step 2
  6. Click on the "New message" badge that appeared at the top of the chat
  7. Confirm the page scrolls to the bottom of the comment history
  8. Click on the second link sent on step 3.
  9. Click on the "New message" badge once again
  10. Confirm the page scrolls to the bottom of the comment history
  • 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 the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • 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 verified the translation was requested/reviewed 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.js 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.
  • 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
android-native-d.mp4
Android: mWeb Chrome
android-mweb_d.mp4
iOS: Native
ios-native_d.mp4
iOS: mWeb Safari
ios-msfari_d.mp4
MacOS: Chrome / Safari
macos-web-d.mp4
MacOS: Desktop
macos-desktop_d.mp4

@tsa321 tsa321 requested a review from a team as a code owner August 1, 2024 00:27
@melvin-bot melvin-bot bot requested review from s77rt and removed request for a team August 1, 2024 00:27
Copy link

melvin-bot bot commented Aug 1, 2024

@s77rt 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]

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 1, 2024

@s77rt I am not sure if I should include my proposed fix for paginationUtils. Should I include it or not?

@s77rt
Copy link
Contributor

s77rt commented Aug 1, 2024

@tsa321 Is the pagination bug still reproducible? If so can you please add reproduction steps?

@s77rt
Copy link
Contributor

s77rt commented Aug 1, 2024

@tsa321 It seems that something broke

Screen.Recording.2024-08-01.at.8.31.50.AM.mov

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 1, 2024

@s77rt Thanks for the review.

For the last part of the video, where the page doesn’t scroll to the last message, we need to include the pageUtils fix.

Regarding the flicker of the loading skeleton, could you provide more details about the linked message, such as how many positions up from the last message it is? Also, could you reproduce the issue in the main branch?
I’m having difficulty reproducing the flicker issue, but found another bug instead. I don't know if it is related:

macos-web-d.mp4

I will try to submit new commit tomorrow.
Thank you...

@s77rt
Copy link
Contributor

s77rt commented Aug 1, 2024

The latest commit didn't fix the reported but and now the "New message" button is not visible

Screen.Recording.2024-08-01.at.6.16.02.PM.mov

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 1, 2024

@s77rt, since the current commit is minimal, could you check if the following three bugs are also present in the main branch by manually reverting my changes?

  1. The loading skeleton flicker (it disappears after I merge with the main branch, right? based on your last video).
  2. The scrolling-to-last-message bug.
  3. The new message button not appearing (I think this might be a bug in the main branch).

Also, is it possible for me to get the exported Onyx data?

@s77rt
Copy link
Contributor

s77rt commented Aug 2, 2024

@tsa321 Those bugs appear to be on main as well and must be fixed as they block testing the original bug

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 2, 2024

@s77rt I have tried to fix the bugs in the last commit. Although there is a GitHub check error, could you please re-test it

Signed-off-by: Tsaqif <[email protected]>
@@ -95,7 +96,8 @@ function getParentReportAction(parentReportActions: OnyxEntry<OnyxTypes.ReportAc
return parentReportActions[parentReportActionID ?? '0'];
}

function ReportScreen({route, currentReportID = '', navigation}: ReportScreenProps) {
function ReportScreen({currentReportID = '', navigation}: ReportScreenProps) {
const route = useRoute<RouteProp<AuthScreensParamList, typeof SCREENS.REPORT>>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this change necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@s77rt When a user clicks the same linked message twice (when the current URL path and the clicked link are the same), the useRoute returns a different object (different reference to object), but it has the same content as the previous one. However, the route property of the ReportScreen remains the same in both content and object reference. Consequently, the second click does not work (won't re-render) using route property of ReportScreen. Here is the video:

using route property of report screen:
usginRouteProperty.mp4
using useRoute:
usingUseRoute.mp4

Copy link
Contributor

Choose a reason for hiding this comment

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

But this is already working on main, what broke it?

Screen.Recording.2024-08-04.at.5.14.09.PM.mov

Copy link
Contributor Author

@tsa321 tsa321 Aug 5, 2024

Choose a reason for hiding this comment

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

@s77rt Because I am fixing this bug, I am using the same source of route in ReportScreen, ReportActionsView, and ReportActionsList.

In your video, the bug does not appear in the main branch because ReportActionsView is using useRoute.

You can reproduce this bug by reverting these two lines in my changes, meaning by using the route property of ReportScreen instead of useRoute.

Copy link
Contributor

Choose a reason for hiding this comment

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

@tsa321 Can you please clarify the solution independently for those two bugs:

  • Not showing "new message" button
  • Not navigating on clicking same report action link

(Also please merge main)

@@ -124,7 +124,7 @@ function mergeAndSortContinuousPages<TResource>(sortedItems: TResource[], pages:
const result = [sortedPages[0]];
for (let i = 1; i < sortedPages.length; i++) {
const page = sortedPages[i];
const prevPage = sortedPages[i - 1];
const prevPage = result?.at(-1) ?? sortedPages[i - 1];
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we fallback to sortedPages[i - 1]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I am trying to fix a type-checking error. result?.at(-1) gives a type-checking error. Should I use result[result?.length - 1] instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

prevPage is expected to be undefined at first, no need for the fallback

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, since result?.at(-1) fails the type check, I will use result[result?.length - 1] instead.

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 5, 2024

@tsa321 Is the pagination bug still reproducible? If so can you please add reproduction steps?

I missed this comment.

To reproduce the issue, the steps are:

  1. Clear the Onyx cache.
  2. Click a link to a message 170 messages above the latest message, then click the New Message button.
  3. Click a link to a message 60 messages above the latest message, then click the New Message button.
  4. Notice that after clicking the New Message button, the message does not immediately appear to be the latest message.

Signed-off-by: Tsaqif <[email protected]>
@@ -124,7 +124,7 @@ function mergeAndSortContinuousPages<TResource>(sortedItems: TResource[], pages:
const result = [sortedPages[0]];
for (let i = 1; i < sortedPages.length; i++) {
const page = sortedPages[i];
const prevPage = sortedPages[i - 1];
const prevPage = result[result.length - 1];
Copy link
Contributor

Choose a reason for hiding this comment

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

prepage (result[result.length - 1]) could be same as page if the result contains only one page

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@s77rt What? I don't understand. Could you elaborate please?
Do you mean when the sortedPages.length is 1. If it is 1 it won't even enter the for loop.

Copy link
Contributor

Choose a reason for hiding this comment

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

If result length is 1, then:
page = sortedPages[0]
and
prevPage = sortedPages[0]

page is same as prevPage which is misleading and could cause bugs

Copy link
Contributor Author

@tsa321 tsa321 Aug 5, 2024

Choose a reason for hiding this comment

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

@s77rt Maybe I still don't understand.
The i in the for loop starts at 1, not 0, so page = sortedPages[0] is not possible. Consequently, page and prevPage won't be the same.

Am I missing something?

const prevPage = result[result.length - 1]; Here I am using the last updated page of result and not the sortedPages.
The end of result could be only 1 continuous page for for example 10 pages in sortedPages. Because the function merge the pages into one continuous page.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah right! my bad

@@ -95,7 +96,8 @@ function getParentReportAction(parentReportActions: OnyxEntry<OnyxTypes.ReportAc
return parentReportActions[parentReportActionID ?? '0'];
}

function ReportScreen({route, currentReportID = '', navigation}: ReportScreenProps) {
function ReportScreen({currentReportID = '', navigation}: ReportScreenProps) {
const route = useRoute<RouteProp<AuthScreensParamList, typeof SCREENS.REPORT>>();
Copy link
Contributor

Choose a reason for hiding this comment

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

@tsa321 Can you please clarify the solution independently for those two bugs:

  • Not showing "new message" button
  • Not navigating on clicking same report action link

(Also please merge main)

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 5, 2024

@s77rt for bug:

  1. Not showing "new message" button. Fix: use one source of the route from in ReportScreen , ReportActionsView and ReportActionsList. So the components will synchronized when the route changes.
  2. Not navigating on clicking same report action link. Fix: Must use useRoute to get the value of route in ReportScreen. Using the route property of ReportScreen will cause this bug to persist.

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 6, 2024

@s77rt Is it also reproducible in main?
Also could you reproduce it before I revert the route scheme?
I cannot reproduce that issue like I said in my previous comment, so it will be hard to figure it out.

@s77rt
Copy link
Contributor

s77rt commented Aug 6, 2024

@tsa321 I can reproduce on main and also before the routes changes revert.

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 6, 2024

@s77rt Should I fix that issue as well? I need more information to reproduce the bug.

@s77rt
Copy link
Contributor

s77rt commented Aug 7, 2024

@tsa321 It would be better if we can get this fixed or at least find what went wrong. Can't you reproduce the bug on main? There are no specific steps besides clicking on the report action link

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 7, 2024

@s77rt I cannot reproduce the issue, so it will be really difficult to figure out. Is your connection slow? It might be related to isOffline. Could you console log isOffline in ReportScreen?

I'm just guessing here because I can't reproduce the issue. Could you provide more information: which counts from the last message are the first and second linked messages, and how many messages are in the report?

Or if you could invite me to the room or make it public report...

Alternatively, we could address this in a follow-up PR.

@s77rt
Copy link
Contributor

s77rt commented Aug 7, 2024

@tsa321 Let's not block on that.

Click on the second link sent on step 5.

This should refer to step 3

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 7, 2024

@s77rt I have edited the test step.

@s77rt
Copy link
Contributor

s77rt commented Aug 7, 2024

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 the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • 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.js 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.
  • 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
android.mov
Android: mWeb Chrome
mweb-chrome.mov
iOS: Native
ios.mov
iOS: mWeb Safari
mweb-safari.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov

@s77rt
Copy link
Contributor

s77rt commented Aug 7, 2024

On Android the new message button does not scroll to the bottom

android-bug.mov

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 7, 2024

@s77rt, on Android, this issue occurs in the main branch on many comment linkings. Even without clearing the Onyx cache (cached messages exist) , the new message button fails to display the newest messages correctly.

Before merging the main branch, everything worked as expected, as shown in the Android video test I uploaded. However, after merging, the same link I used for testing fails to display the newest message.
Additionally, when tapping on the comment link, the app does not display the linked message correctly.

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 7, 2024

@s77rt update:

Removing this useEffect:

useFocusEffect(
useCallback(() => {
onScreenFocus();
}, [onScreenFocus]),
);

works as expected for me.

@s77rt
Copy link
Contributor

s77rt commented Aug 7, 2024

@tsa321 That code was there for a while, it can't be the culprit. Can you try find the offending PR or the root cause. Also try disable strict mode and test on production

setScrollPosition(undefined);
return () => setScrollPosition(undefined);
},[])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The CustomFlatList component tries to scroll the flat list back using useFocusEffect below. However, when we open or click on a comment link, we don't need to restore the scroll position. Therefore, we must reset the last scroll position to undefined on mount and unmount.

import type {FlatListProps, NativeScrollEvent, NativeSyntheticEvent} from 'react-native';
import {FlatList} from 'react-native';
import {ActionListContext} from '@pages/home/ReportScreenContext';

// FlatList wrapped with the freeze component will lose its scroll state when frozen (only for Android).
// CustomFlatList saves the offset and use it for scrollToOffset() when unfrozen.
function CustomFlatList<T>(props: FlatListProps<T>, ref: ForwardedRef<FlatList>) {
const {scrollPosition, setScrollPosition} = useContext(ActionListContext);
const {setScrollPosition, getScrollPosition} = useContext(ActionListContext);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am replacing scrollPosition with getScrollPosition because scrollPosition is a state in ReportScreen and does not represent the last value here. Using useState for scroll position also causes the ReportScreen to re-render unnecessarily when user stop scrolling the flat list.
I have verified that scrollPosition is only used in here.
For more details, see ReportScreen.


const getScrollPosition = useCallback(() => {
return scrollPosition;
}, []);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am replacing scrollPosition with getScrollPosition because scrollPosition is a state in ReportScreen and the setScrollPosition will cause re-render of reportscreen unnecessarily and cause the flatlist to jumping around. Using useState for scroll position also causes the ReportScreen to re-render unnecessarily when user stop scrolling the flat list.

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 8, 2024

@s77rt I have fixed the issue please review before I am fixing the type or lint errors.

@s77rt
Copy link
Contributor

s77rt commented Aug 8, 2024

@tsa321 Before going with a solution, we need to find the root cause and since this broke recently it's better to find the offending PR first

@tsa321
Copy link
Contributor Author

tsa321 commented Aug 8, 2024

I haven’t been able to find it. Should we wait for it to be fixed in the main branch, or do you have another suggestion? I'm fine with either option.

@s77rt
Copy link
Contributor

s77rt commented Aug 9, 2024

@tsa321 Can you revert the latest changes and merge main. I think it would be better to have this handled separately

Signed-off-by: Tsaqif <[email protected]>
Signed-off-by: Tsaqif <[email protected]>
@tsa321
Copy link
Contributor Author

tsa321 commented Aug 10, 2024

@s77rt I have reverted the last changes and merged main

Copy link
Contributor

@s77rt s77rt left a comment

Choose a reason for hiding this comment

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

on Android it's partially working as expected but that seems due to another cause. Let's not block on that

android.mov

@melvin-bot melvin-bot bot requested a review from francoisl August 11, 2024 18:57
@francoisl francoisl merged commit e7fe622 into Expensify:main Aug 12, 2024
16 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.

@Beamanator
Copy link
Contributor

FYI I believe this was deployed to prod yesterday, from this checklist - #47219

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.

5 participants