You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$500] Expense - Unable to save Merchant by hitting Enter in confirmation page #37294
changed the title [-]Expense - Unable to save Merchant by hitting Enter in confirmation page[/-][+][$500] Expense - Unable to save Merchant by hitting Enter in confirmation page[/+]on Feb 27, 2024
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Please re-state the problem that we are trying to solve in this issue.
Expense - Unable to save Merchant by hitting Enter in confirmation page
What is the root cause of that problem?
The pr is - #31606
The root cause of problem is we have subscribed to enter shortcut on BaseOptionsSelector, that prevents the form from submitting, and that avoid bubbling of that event.
What changes do you think we should make in order to solve the problem?
We shall unsubscribe to Enter shortcut key event.
When we go to different pages (ex - Description, Merchant)
To Do this, we need to make following changes -
we shall also check if isFocused (not from prop) is true. This means we are only subscribing if we are on the page that has BaseOptionsSelector, not the inside. Because then it will act as we press enter it's on the confirmation list.
Changes
useEffect(()=>{// Unregister the shortcut before registering a new one to avoid lingering shortcut listenerenterSubscription.current();if(!disableEnterShortCut&&isFocused){subscribeToEnterShortcut();}// eslint-disable-next-line react-hooks/exhaustive-deps},[disableEnterShortCut]);
2. While subscribing to events, we shall also check if the window is focused (the value we using `useIsFocused()`) for this use effect
Update: re-refactoring is ready to be tested, it fixes all the regression issues I was aware of. Please test it (especially the tags, because I could not yet replicate the scenario on my site).
The fix is based on the @roryabraham solution, so special thanks for him!
Link to PR: #37494
Activity
[-]Expense - Unable to save Merchant by hitting Enter in confirmation page[/-][+][$500] Expense - Unable to save Merchant by hitting Enter in confirmation page[/+]melvin-bot commentedon Feb 27, 2024
Job added to Upwork: https://www.upwork.com/jobs/~0173bf7e04af9fbaa2
melvin-bot commentedon Feb 27, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Pujan92 (
External)github-actions commentedon Feb 27, 2024
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
melvin-bot commentedon Feb 27, 2024
Triggered auto assignment to @grgia (
Engineering), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.kbecciv commentedon Feb 27, 2024
We think that this bug might be related to #wave5-free-submitters
CC @dylanexpensify
2 remaining items
Pujan92 commentedon Feb 27, 2024
Please link the offended PR as it is not reproducible on production.
grgia commentedon Feb 27, 2024
I don't think this needs to block deploy
Pujan92 commentedon Feb 27, 2024
It is from #31606 where
BaseOptionsSelectorenter callback triggered, same is happening for the description step form too. cc: @PiotrfjBhuvaneshPatil commentedon Feb 27, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Expense - Unable to save Merchant by hitting Enter in confirmation page
What is the root cause of that problem?
The pr is - #31606
The root cause of problem is we have subscribed to enter shortcut on
BaseOptionsSelector, that prevents the form from submitting, and that avoid bubbling of that event.What changes do you think we should make in order to solve the problem?
We shall unsubscribe to
Entershortcut key event.When we go to different pages (ex - Description, Merchant)
To Do this, we need to make following changes -
App/src/components/OptionsSelector/BaseOptionsSelector.js
Lines 370 to 377 in 04644d8
we shall also check if
isFocused(not from prop) is true. This means we are only subscribing if we are on the page that hasBaseOptionsSelector, not the inside. Because then it will act as we press enter it's on the confirmation list.Changes
App/src/components/OptionsSelector/BaseOptionsSelector.js
Lines 379 to 387 in 04644d8
Changes
App/src/components/OptionsSelector/BaseOptionsSelector.js
Lines 305 to 309 in 069efef
result -
Screen.Recording.2024-02-28.at.2.32.24.AM.mov
What alternative solutions did you explore? (Optional)
melvin-bot commentedon Feb 28, 2024
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.
Piotrfj commentedon Feb 29, 2024
Update: re-refactoring is ready to be tested, it fixes all the regression issues I was aware of. Please test it (especially the tags, because I could not yet replicate the scenario on my site).
The fix is based on the @roryabraham solution, so special thanks for him!
Link to PR: #37494
melvin-bot commentedon Mar 4, 2024
@Pujan92, @grgia Eep! 4 days overdue now. Issues have feelings too...
grgia commentedon Mar 4, 2024
I take it we can close this one out @Pujan92 ?
situchan commentedon Mar 4, 2024
Offending PR was reverted - #31606 (comment)
Fine to close