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
[HOLD for payment 2025-01-07] Web - NetSuite - Input is not auto-focused in setup RHP after dismissing and restarting setup #53314
Version Number: v9.0.68-2 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers):htad26+jhsajfsdf@gmail.com Issue reported by: Applause Internal Team
Action Performed:
Log into new dot
Create a new workspace
Navigate to workspace settings > More features > Enable accounting
Click on connect next to NetSuite > Upgrade > Go through the flow until step 5
Here notice that the input is auto-focused
When asked to enter credentials, dismiss the RHP by clicking outside of it
Now click on connect to NetSuite and go through the flow until step 5
Expected Result:
The input is auto-focused in the enter credentials RHP
Actual Result:
The input is not auto-focused in the enter credentials RHP. The issue also occurs when reconnecting to NetSuite after disconnecting
Edited by proposal-police: This proposal was edited at 2024-11-30 17:04:38 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Input is not auto-focused in setup RHP after dismissing and restarting the setup
What is the root cause of that problem?
This issue occurs due to a bug in the ConnectToNetSuiteFlow and the ConnectToSageIntacctFlow components.
We're updating reuseConnectionPopoverPosition state without verifying if the new value differs from the current one. Every time the setReuseConnectionPopoverPosition func is called, a new object is created. React interprets this as a change and marks the component for re-rendering.
This creates an infinite loop: reuseConnectionPopoverPosition changed > component re-renders > reuseConnectionPopoverPosition changed > component re-renders...
The infinite re-render then blocks the execution of InteractionManager.runAfterInteractions callbacks, which is used inside the useAutoFocusInput() hook. Specifically, it stalls on this line of the react-native-web package. The requestIdleCallback function waits until nothing blocks the event loop, but the continuous re-renders prevent this from happening.
What changes do you think we should make in order to solve the problem?
Add an if check to ensure the horizontal or vertical property has actually changed before updating the state
consthorizontal=x+width;constvertical=y+height;// Check if the value has changed to prevent infinite re-rendersif(reuseConnectionPopoverPosition.horizontal!==horizontal||reuseConnectionPopoverPosition.vertical!==vertical){setReuseConnectionPopoverPosition({horizontal, vertical});}
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Write tests that ensure the ConnectToNetSuiteFlow and the ConnectToSageIntacctFlow components do not re-render when there are no changes to their props.
Please re-state the problem that we are trying to solve in this issue.
Input is not auto-focused in setup RHP after dismissing and restarting the setup
What is the root cause of that problem?
inputRef.current loses its relevance: By the time the task in InteractionManager executes, the reference to inputRef.current might be outdated or null.
What changes do you think we should make in order to solve the problem?
Move focus() Outside of InteractionManager
By calling inputRef.current.focus() immediately when the conditions are ready, we ensure the element receives focus as soon as possible. However, we can still use InteractionManager to gracefully handle other UI interactions if necessary.
changed the title [-]Web - NetSuite - Input is not auto-focused in setup RHP after dismissing and restarting setup[/-][+][HOLD for payment 2025-01-07] Web - NetSuite - Input is not auto-focused in setup RHP after dismissing and restarting setup[/+]on Dec 31, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.79-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@VictoriaExpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
Skipping the payment summary for this issue since all the assignees are employees or vendors. If this is incorrect, please manually add the payment summary SO.
Activity
melvin-bot commentedon Nov 29, 2024
Triggered auto assignment to @VictoriaExpensify (
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.andriivitiv commentedon Nov 29, 2024
Edited by proposal-police: This proposal was edited at 2024-11-30 17:04:38 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Input is not auto-focused in setup RHP after dismissing and restarting the setup
What is the root cause of that problem?
This issue occurs due to a bug in the
ConnectToNetSuiteFlowand theConnectToSageIntacctFlowcomponents.We're updating
reuseConnectionPopoverPositionstate without verifying if the new value differs from the current one. Every time thesetReuseConnectionPopoverPositionfunc is called, a new object is created. React interprets this as a change and marks the component for re-rendering.This creates an infinite loop:
reuseConnectionPopoverPositionchanged > component re-renders >reuseConnectionPopoverPositionchanged > component re-renders...App/src/components/ConnectToNetSuiteFlow/index.tsx
Lines 60 to 67 in 32ce9d4
App/src/components/ConnectToSageIntacctFlow/index.tsx
Lines 65 to 72 in 32ce9d4
The infinite re-render then blocks the execution of
InteractionManager.runAfterInteractionscallbacks, which is used inside theuseAutoFocusInput()hook. Specifically, it stalls on this line of thereact-native-webpackage. TherequestIdleCallbackfunction waits until nothing blocks the event loop, but the continuous re-renders prevent this from happening.What changes do you think we should make in order to solve the problem?
Add an
ifcheck to ensure thehorizontalorverticalproperty has actually changed before updating the stateWhat specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Write tests that ensure the
ConnectToNetSuiteFlowand theConnectToSageIntacctFlowcomponents do not re-render when there are no changes to their props.avkotau commentedon Nov 29, 2024
Please re-state the problem that we are trying to solve in this issue.
Input is not auto-focused in setup RHP after dismissing and restarting the setup
What is the root cause of that problem?
inputRef.current loses its relevance: By the time the task in InteractionManager executes, the reference to inputRef.current might be outdated or null.
What changes do you think we should make in order to solve the problem?
Move focus() Outside of InteractionManager
By calling inputRef.current.focus() immediately when the conditions are ready, we ensure the element receives focus as soon as possible. However, we can still use InteractionManager to gracefully handle other UI interactions if necessary.
App/src/hooks/useAutoFocusInput.ts
Lines 24 to 39 in f12b73c
Contributor details
Your Expensify account email: fokusnik9141@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01e80951ba5f62450f
melvin-bot commentedon Nov 29, 2024
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
melvin-bot commentedon Dec 3, 2024
@VictoriaExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
VictoriaExpensify commentedon Dec 4, 2024
Seeing if this can be fixed as part of the Sage issue - #53156
VictoriaExpensify commentedon Dec 9, 2024
Followed up on this issue - #53156
12 remaining items
[-]Web - NetSuite - Input is not auto-focused in setup RHP after dismissing and restarting setup[/-][+][HOLD for payment 2025-01-07] Web - NetSuite - Input is not auto-focused in setup RHP after dismissing and restarting setup[/+]melvin-bot commentedon Dec 31, 2024
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Dec 31, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.79-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-01-07. 🎊
melvin-bot commentedon Dec 31, 2024
@VictoriaExpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
melvin-bot commentedon Jan 7, 2025
Skipping the payment summary for this issue since all the assignees are employees or vendors. If this is incorrect, please manually add the payment summary SO.
VictoriaExpensify commentedon Jan 10, 2025
No payment required, closing the issue out