-
Notifications
You must be signed in to change notification settings - Fork 3k
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 double click navigating twice on lists #25604
Fix double click navigating twice on lists #25604
Conversation
@parasharrajat 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] |
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.
Fix Lint warnings..
@parasharrajat Thank you for the quick response. I have replied to your feedback above. Please have a look when you get a change. |
Gentle bump @parasharrajat. Also, I replied to your comments above. |
Bump @parasharrajat. |
Checking it. |
Oops, the backend is throwing errors ATM and not letting me in. I will check back in sometime. |
Sure no worries. I thought it was just me :) |
Bump @parasharrajat, the BE seems to be fixed now. Please have a look when you get a chance. Thanks |
@huzaifa-99 Please merge main. |
Main merged @parasharrajat. |
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.
LGTM, but got one question
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.
Thank you!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/mountiny in version: 1.4.77-0 🚀
|
This PR is failing because of issue #24074 The issue is reproducible in: Web, mWeb and Desktop 1717063381253.1.mp41717059402328.Wkgn6986.mp4 |
@kbecciv Could you please mention where it is failing? |
CVDN6051.MP4
bandicam.2024-05-30.12-20-53-216.mp4
Screen.Recording.2024-05-30.at.18.04.49.1.mp4 |
Looks like we didn't clearly specify the test steps. @huzaifa-99 Could you please update those to be more clear? |
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.77-11 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.77-11 🚀
|
@huzaifa-99 Did you look into the comments from QA team? |
@parasharrajat my apologies for the issue here. I just had a look and it is reproducible with mouse/touch clicks and works correctly with the enter keys for focused options. We are using this debounce timer in
I tested with a
this seems to do the trick, but again this is on the trailing edge. We can also throw in a recording.mp4What direction should we follow, @parasharrajat? |
Could you please share explanation of the problem? Also explain impact of each suggestion and how it is different from old solution? |
Backstory
In some scenarios, the In terms of events, it would be like this
You can test this out by making the - const debouncedOnSelectRow = useCallback(lodashDebounce(onSelectRow, 1000, {leading: true}), [onSelectRow]);
+ const debouncedOnSelectRow = useCallback(lodashDebounce(onSelectRow, 1000, {leading: true}), [
+ // onSelectRow
+ ]); The original assumption was for If we debounce on the trailing edge, it won't give enough time for event 4 to happen, the navigation calls would have finished by then. The same solution, but with some delay timer on the trailing edge, rather than the leading one. I experimented with this and it seems to work for click/touch events for navigation cases - const debouncedOnSelectRow = useCallback(lodashDebounce(onSelectRow, 1000, {leading: true}), [onSelectRow]);
+ const debouncedOnSelectRow = useCallback(lodashDebounce(onSelectRow, 200), [onSelectRow]); I tested it out and it looks like the recording from this comment. This is only for the mouse/touch clicks, the arrow keys debounce works correctly in current state. cc: @parasharrajat |
Bump, @parasharrajat |
@parasharrajat can you please check that out? |
@huzaifa-99 Ok, I see. Let's do that. Please open a new PR. I don't see any other solution. |
sure, will try to create one by EOD tomorrow. |
PR created: #44360, apologies for the delay. cc: @parasharrajat |
Details
The
onSelectRow
of<SelectionList/>
was running multiple times on multiple quick clicks/presses. This caused some side-effects like navigation and API calls that ran in some of the callbacks for theonSelectRow
prop to also run multiple times.This PR adds a debounce time prop
debouncedOnRowSelect
for theonSelectRow
in<SelectionList/>
to prevent unnecessary function calls toonSelectRow
from happening.Fixed Issues
$ #24074
PROPOSAL: #24074 (comment)
Tests
Visit each of these components/pages and verify that pressing any option from the list multiple times (either with a mouse click, touch, arrow keys + enter) doesn’t navigate to or navigate back multiple times or make multiple API calls.
SearchPage
->/search
PronounsPage
->/settings/profile/pronouns
TimezoneSelectPage
->/settings/profile/timezone/select
CountrySelectionPage
->/settings/profile/address/country
PriorityModePage
->/settings/preferences/priority-mode
LanguagePage
->/settings/preferences/language
ThemePage
->/settings/preferences/theme
NotificationPreferencePage
->/w/{workspaceID}/r/{reportID}/settings/notification-preferences
WriteCapabilityPage
->/w/{workspaceID}/r/{reportID}/settings/who-can-post
VisibilityPage
->/w/{workspaceID}/r/{reportID}/settings/visibility
TaskAssigneeSelectorModal
->/r/{reportID}/assignee
TaskShareDestinationSelectorModal
->/new/task/share-destination
IOUCurrencySelection
->create/send/currency/1/{requestID}
MoneyRequestParticipantsSelector
->/create/send/participants/1/{requestID}
IOURequestStepCurrency
->/create/request/currency/1/{requestID}
MoneyTemporaryForRefactorRequestParticipantsSelector
->/create/request/participants/1/{requestID}
WorkspaceProfileCurrencyPage
->/workspace/{workspaceID}/profile/currency
WorkspaceUnitPage
->/workspace/{workspaceID}/rateandunit/unit
WorkspaceAutoReportingMonthlyOffsetPage
->/workspace/{workspaceID}/settings/workflows/auto-reporting-frequency/monthly-offset
BusinessTypeSelectorModal
->/bank-account/
— visit company step incorporation typeWorkspaceMemberDetailsRoleSelectionPage
->/settings/workspaces/{workspaceID}/members/{accountID}/role-selection
WorkspaceWorkflowsApproverPage
->/settings/workspaces/{workspaceID}/settings/workflows/approver
WorkspaceWorkflowsPayerPage
->/workspace/{workspaceID}/settings/workflows/payer
Offline tests
Same as "Tests" section above
QA Steps
Same as "Tests" section above
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)/** comment above it */
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
Chrome
Web.Chrome.1.mp4
Web.Chrome.2.mp4
Safari
Web.Safari.1.mp4
Web.Safari.2.mp4
Mobile Web - Chrome
mWeb.Chrome.1.mp4
mWeb.Chrome.2.mp4
mWeb.Chrome.3.mp4
Mobile Web - Safari
mWeb.Safari.1.mp4
mWeb.Safari.2.mp4
Desktop
Desktop.Native.1.mp4
Desktop.Native.2.mp4
iOS
IOS.Native.1.mp4
IOS.Native.2.mp4
Android
Android.Native.1.mp4
Android.Native.2.mp4
Android.Native.3.mp4