Closed lanitochka17 closed 9 months ago
Sorry I missed this last week - I will call it out asking for a volunteer when I do the weekly update this week
Is this to do with FlatList specifically?
@TMisiukiewicz and @adhorodyski might have some insights into what is going wrong here
Going to try to get the performance update out tonight
performance update going out today
Update went out - @hurali97 and @kacper-mikolajczak are going to take a look
Hey 👋
We have some findings from our investigation and we want to share those with you.
useEffect
inside NewChatPage
even before the animation finishes but since the component is mounted, the effect is called. The ideal way to handle that is to wait for the animation to complete and then execute the function. We have a prop called onEntryTransitionEnd
on ScreenWrapper
we can use that and move our useEffect
body to a new method and pass it to the onEntryTransitionEnd
. Then we can also leverage another prop didScreenTransitionEnd
from ScreenWrapper
and use that to decide to show Skeleton Loader by using isOptionsDataReady && didScreenTransitionEnd
. Alternatively, we can solve this by using InteractionManager.runAfterInteractions
to wait until the animations are completed.The above fixes the issue but during the investigation we also found that there are many react commits when we close the Modal and they amount to more than 130+ in numbers, to fix those we suggest following options:
The Button
component re-renders a lot because it's used in OptionRow
for the Add To Group
UI element. Inside of Button
component we have useIsFocused
and useActiveElement
. Now, since it's a part of the renderItem
each time any of those changes, part of our renderItem
will render, which is Button
and it's children in this case.
First improvement is to move this code which is required for keyboard shortcut to outside of Button
component and call it something like KeyboardShortcutComponent
and in there use useIsFocused
and useActiveElement
and keyboard shortcut code. This way, we will only re-render KeyboardShortcutComponent
and not the whole Button
component.
Second, we can remove useIsFocused
in favour of useFocusEffect
and store that boolean value in a ref. The reason here is we are only using isFocused
in the keyboardShortcutCallback
which will take updated value each time the function is called, so we can safely remove the state dependency on useIsFocused
hook.
Third, we can refactor the code for useActiveElement
to useActiveElementRole
because we are only using the role
property from it, so there seems no point in storing the whole HTML there. On top of that, since the value from this hook is used to evaluate config
for useKeyboardShortcut
hook, so we can refactor the state implementation in useActiveElement
to ref based.
Lastly, we will also benefit from the improvements in this PR, since it targets the transition improvements for SearchPage
on slower devices. For example, BaseOptionsSelector
also underperforms in our case, which is optimised in the linked PR. Once that PR is merged, we can simply sync main in our new PR that we will create.
The results below are from the main branch and from all of the improvements mentioned above ( including some parts of the linked PR )
https://github.com/Expensify/App/assets/47336142/b7e2d0d5-3199-45ca-bbff-b44a062dd48a
https://github.com/Expensify/App/assets/47336142/05c5aae9-9918-4546-8f49-9cc7ebe76c89
What's next on this one @eVoloshchak @muttmuure @Julesssss?
@lschurr the PR was just assigned to the C+ for review, so nothing from us yet
Seems like we'll need to fix this. Did you see the comment, @hurali97?
@Julesssss yeah, I will try to fix that by Monday, since we are off tomorrow 👍
⚠️ Looks like this issue was linked to a Deploy Blocker here
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
⚠️ Looks like this issue was linked to a Deploy Blocker here
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
Hello @muttmuure @hurali97 @Julesssss @lschurr
I have tried to further optimize @hurali97's proposal here https://github.com/Expensify/App/pull/34480.
I tried to do 2 main things
focusin
, and focusout
for every use of useActiveElementRole
, we are going to create context of activeRole
, and will listen only once for events inside the Provider, which will be supplied to App root component directly. The aim was to remove the redundancy of listeners, as we know every button will have these listeners, and there are almost no places on App where we don't have a button.pressOnEnter
prop to conditionally render KeyboardShortcutComponent
, which will help in less re-render on changing of activeRole
.Now we use state for storing activeRole
instead of ref cause this caused a regression https://github.com/Expensify/App/issues/34474, and restoring to using state directly causing some performance lag.
If you agree with me, @hurali97 can you profile https://github.com/Expensify/App/pull/34480 to make sure there is no performance degradation?
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.4.24-8 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-01-22. :confetti_ball:
For reference, here are some details about the assignees on this issue:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
oh I missed this notification
I have tried to further optimize @hurali97's https://github.com/Expensify/App/issues/28916#issuecomment-1853920181 here https://github.com/Expensify/App/pull/34480.
We're going to go ahead with this change on this linked PR
Not overdue
Is the problem resolved? Can we go ahead and pay?
This looks correct. @eVoloshchak - you can request payment via newdot.
Closing.
There were several regressions. One is not resolved yet.
@hurali97, could you take a look at the comment above?
@hurali97, bump on the above
@hurali97, bump on the above
ignore this, I can see all of the regressions were solved
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
Modal opens without any lags or freezes
Actual Result:
Modal freezes when it is opened / sometimes the sliding motion is neglected and it appears immediately without any sliding effect
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.78.0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
https://github.com/Expensify/App/assets/78819774/39206801-5320-47fb-9d9c-2347b8476204
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
View all open jobs on GitHub
Upwork Automation - Do Not Edit