-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
HIGH: (Comment linking: step 2) [23220] WEB maintain visible content position #32098
HIGH: (Comment linking: step 2) [23220] WEB maintain visible content position #32098
Conversation
…rgelo/expensify-app-fork into feat/#Expensify#23220-web-maintainVisibleContentPosition
…rgelo/expensify-app-fork into feat/#Expensify#23220-web-maintainVisibleContentPosition
@0xmiroslav 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] |
…rgelo/expensify-app-fork into feat/#Expensify#23220-web-maintainVisibleContentPosition
Hey all, I've been following this PR as well as necolas/react-native-web#2588, since I would also like to get I've got it mostly working, but wanted to point out one thing I noticed in the usage of the I fixed this for my use case by removing observation of attribute changes altogether: mutationObserver.observe(contentView, {
childList: true,
subtree: true,
}); This works for me, since I am only interested in layout changes due to items being prepended to the list. I am not confident that removing this for all cases is safe, but perhaps at least making it configurable or allowing more granular control over which specific attribute changes to look for could avoid these cases. @janicduplessis FYI, since this could be relevant to the upstream PR. Happy to provide more details if needed. Also, wanted to say thanks for the work on this issue and for making it open source! |
I did think about that, but thought it wouldn’t handle cases where items are resized. You do bring up a good point though. Thinking about it more I wonder if it would be possible to use ResizeObserver on the content view instead since we only want to maintain position when the content view size changes. |
I think However, I am not sure how Sorry if this is a bit off-topic from this PR, but wanted to mention it in case it is relevant. |
…pensify#23220-web-maintainVisibleContentPosition
Mostly looks good. this branch: Screen.Recording.2023-12-07.at.4.32.03.pm.movmain: Screen.Recording.2023-12-07.at.4.32.46.pm.mov |
I'm not particularly concerned about that behavior judging by the videos. What happens if there's more than one page of messages in the chat? |
Screen.Recording.2023-12-07.at.6.46.24.pm.movBut the issue is not consistent. Sometimes show last message immediately |
Yeah, looks like we need to fix that |
…pensify#23220-web-maintainVisibleContentPosition
done |
@0xmiroslav, is it good for you? Can we get it merged? |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb Chromeandroid.moviOS: NativeiOS: mWeb Safariweb.movMacOS: Chrome / Safariweb.movweb.movMacOS: Desktop |
Note that I was able to reproduce the weird scrolling issue, but only on Android Chrome, which on a dev environment in an emulator was super janky anyways. So I'm not too concerned by that and sort of doubt we'll see it in production. It's not a huge deal even if we do. |
@@ -0,0 +1,207 @@ | |||
/* eslint-disable es/no-optional-chaining, es/no-nullish-coalescing-operators, react/prop-types */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for posterity: these were disabled to keep this code as similar as possible to the upstream PR it's based on: necolas/react-native-web#2588
Hopefully this component only lives in our codebase relatively temporarily. We probably will want to switch to FlashList soon too for the main chat list.
Merging through failing reassure per this comment |
@roryabraham looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Thanks for finalizing review. I will watch out any regressions QA team is reporting. Hope that would not happen again 🙏 |
chat is not scrolled down automatically to see last report action after request money in workspace chat. |
Maybe this should not have been removed? https://github.com/Expensify/App/pull/32098/files#diff-b1c8c4fd8072edbd35c63a7cdd71b63ff1701a6f43529ea794f7720a86460df2L18 |
🚀 Deployed to staging by https://github.com/roryabraham in version: 1.4.24-0 🚀
|
Now this is deploy blocker (not happening on production but staging) @perunt can you please check? |
useEffect(() => {
if (previousLastIndex.current !== lastActionIndex && reportActionSize.current > sortedVisibleReportActions.length) {
reportScrollManager.scrollToBottom();
}
previousLastIndex.current = lastActionIndex;
reportActionSize.current = sortedVisibleReportActions.length;
}, [lastActionIndex, sortedVisibleReportActions.length, reportScrollManager]); Maybe update this logic to fix this issue. |
Going to check this out. Might fix it by going back to https://github.com/Expensify/App/pull/32098/files#diff-b1c8c4fd8072edbd35c63a7cdd71b63ff1701a6f43529ea794f7720a86460df2L18, like @janicduplessis said. But, this could mess up comment linking in the next PR. Still, it's a decent quick fix for staging. |
Can confirm that bringing it back is fixing that issue |
🚀 Deployed to production by https://github.com/thienlnam in version: 1.4.24-3 🚀
|
scrollToOffset(0, true); | ||
} | ||
} | ||
}, [getScrollOffset, scrollToOffset, mvcpMinIndexForVisible, mvcpAutoscrollToTopThreshold, horizontal]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having mvcpAutoscrollToTopThreshold
as a dependency made this function gets re-evaluated on value change. Which also made the setupMutationObserver
function re-evaluated and executed (due to useEffect
). That later function will disconnect the old observer and create a new one. This constant observer recreation is found to disrupt the new message detection.
(Coming from #43600)
|
||
mutationObserverRef.current?.disconnect(); | ||
|
||
const mutationObserver = new MutationObserver(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When list is hidden and reappears, it scrolls down to the bottom. But it should keep its last scroll offset. That is why ignore this callback when list is hidden. Coming from #45434
Details
This PR introduces the maintainVisibleContentPosition property to React Native for Web (RNW), aligning it with the recent updates in React Native (RN). The implementation is based on the changes from the following upstream PRs:
RN upstream: facebook/react-native#35993
RNW upstream: necolas/react-native-web#2588
The initial implementation for this feature (Expensify/App#28793) was reverted (Expensify/App#31158) due to a bug (Expensify/App#31143). This PR addresses and resolves that issue.
🎉 Thanks to @janicduplessis, it was found and fixed 🎉
Fixed Issues
$ #23220
PROPOSAL:
Tests
Offline tests
QA Steps
Testing Goals:
Verify the correctness of the scrolling direction in the chat list.
Ensure the copying process functions as expected.
Confirm that styles are properly applied (with nothing appearing inverted).
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop