Closed IuliiaHerets closed 1 month ago
Triggered auto assignment to @puneetlath (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
We think that this bug might be related to #vip-vsb
@puneetlath FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
Edited by proposal-police: This proposal was edited at 2024-08-13 15:02:15 UTC.
"Please enter a room name" error appears when switching to the Room tab.
We have the logic to validate form when the input get blurred
We should check if the page is not focused then do nothing
const isFocusedRef = useRef(true);
useFocusEffect(
useCallback(() => {
isFocusedRef.current = true;
return () => {
isFocusedRef.current = false;
};
}, []),
);
...
if (shouldValidateOnBlur && isFocusedRef.current) {
onValidate(inputValues, !hasServerError);
}
We can consider to create the hook to detect isFocusedRef
"Please enter a room name" error appears when switching to the Room tab
we don't set shouldValidateOnBlur
here and its default value on FormProvider
is true
https://github.com/Expensify/App/blob/c5feb89f9f02cfb303e86246408f40c4f5a23119/src/pages/workspace/WorkspaceNewRoomPage.tsx#L270-L277
IMO we can set shouldValidateOnBlur
to false
here since it is the only required input text on start room chat
Job added to Upwork: https://www.upwork.com/jobs/~018c5e8d8993a6b3ba
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ahmedGaber93 (External
)
Room - "Please enter a room name" error appears when switching to the Room tab
Chat
and going back to Room
shows error.The form isn't reseted when screen lost's focus.
This is an inconsistency because we also use tab navigator on start IOU request page and there if we switch tab the data and errors are cleared. See the video below.
https://github.com/user-attachments/assets/66a844a2-d574-488e-9993-8a834817a041
We can clear the form errors when screen focus is changed.
FormProvider
to get the resetForm
function through useImperativeHandle
WorkspaceNewRoomPage
we need to call the formRef.current?.resetForm()
when screen is unmounted. The same behaviour can also be seen on IOURequestStartPage
, we clear the form values and errors when tab gets changed. useEffect(() => {
const ref = formRef.current;
if (isFocused) {
return;
}
return () => ref?.resetForm({});
}, [selectedTab, isFocused]);
@ahmedGaber93 For more information
I tried to test the problem on iOS, it works well without any changes. onBlur
is not triggered
https://github.com/user-attachments/assets/329a2ac8-5ed9-46fc-b6ba-ab06bf955b95
So we need to fix this bug on web. When users switch between tabs without any changes, they shouldn't see the error message
https://github.com/user-attachments/assets/5dbb8e20-e970-40ce-8ea1-05760c357a00
BTW, when users blur the input on room page, they will see the error message (like other page)
-> it should preserve the error when users go to Chat
and back to Room
since they already see the error before -> There's no confusion
@ahmedGaber93 What do you think about my proposal? Thanks
Reviewing today
Thanks all for the proposals.
@dominictb's proposal add a solution to prevent onValidate
only while switching the tab.
@nyomanjyotisa's proposal add a solution to prevent onValidate
all the time.
@Krishna2323's proposal add a solution to reset the form after tab switched.
While all the proposals can fix the issue, but @dominictb's proposal is the only that can fix it without change the current UX.
@dominictb's proposal LGTM!
π π π C+ reviewed
Current assignee @puneetlath is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.
https://github.com/user-attachments/assets/66a844a2-d574-488e-9993-8a834817a041
@puneetlath, do you think we should clear the draft data when switching room tabs, just like we do when starting IOU request tabs? If not then you can go with the selected proposal.
This is an inconsistency because we also use tab navigator on start IOU request page and there if we switch tab the data and errors are cleared. See the video below.
I think the reset in IOU is for resetting the draft transaction in Onyx and not for design/UX purpose
I don't think we need to clear the input in this scenario. So @dominictb's proposal sounds good to me. But are there other similar forms on the site? And if so, would they need a similar solution?
@puneetlath My solution will fix on FormProvider, so we just need to update one place.
π£ @ahmedGaber93 π An offer has been automatically sent to your Upwork account for the Reviewer role π Thanks for contributing to the Expensify app!
π£ @dominictb π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
Do we agree π or π
@puneetlath This issue is ready for payment, The PR was deployed to production for 7 days ago (2/9) base on here https://github.com/Expensify/App/pull/47908#issuecomment-2325378109
All paid. Thanks everyone!
If you havenβt already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.19-9 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4849474&group_by=cases:section_id&group_id=296763&group_order=asc Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
The error should only appear when i tap the "Create room" button without entering any room name.
Actual Result:
"Please enter a room name" error appears when switching to the Room tab.
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/0af238bd-f143-4fb6-b884-39bbc9010844
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @ahmedGaber93