-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix Netsuite - App crashes when tapping on export settings after disconnecting with another device #56021
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
Merged
dangrous
merged 18 commits into
Expensify:main
from
hoangzinh:55723-fix-app-crash-when-disconnect-netsuite-on-another-device
Feb 25, 2025
Merged
Fix Netsuite - App crashes when tapping on export settings after disconnecting with another device #56021
Changes from 11 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d34e0b5
Use optional chaining for netsuite?.options to handle nullable of net…
hoangzinh 466bc26
Subcribe policy in Onyx
hoangzinh 6836029
Fix Eslint
hoangzinh fb872cd
Fix eslint
hoangzinh d0a79d2
Merge branch 'main' into 55723-fix-app-crash-when-disconnect-netsuite…
hoangzinh ce52ff4
Merge branch 'main' into 55723-fix-app-crash-when-disconnect-netsuite…
hoangzinh fe7d499
Use optional chaining for netsuite?.options to handle nullable of net…
hoangzinh 17046f8
Fix eslint
hoangzinh 34a4a3c
Trigger Build
hoangzinh 35f9dcc
Merge branch 'main' into 55723-fix-app-crash-when-disconnect-netsuite…
hoangzinh 361395b
Merge branch 'main' into 55723-fix-app-crash-when-disconnect-netsuite…
hoangzinh 4a479d6
Fix typecheck of Default value for inexistent IDs
hoangzinh 0d485c0
Fix typecheck of Default value of netsuite payable account value
hoangzinh 6668710
Fix wrong method call
hoangzinh 5508fc0
Merge branch 'main' into 55723-fix-app-crash-when-disconnect-netsuite…
hoangzinh cb0f24f
Revert change
hoangzinh 4220c2c
Handle undefined value in getRoute functions
hoangzinh c711462
Revert change
hoangzinh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,24 +8,24 @@ import SelectionScreen from '@components/SelectionScreen'; | |
import Text from '@components/Text'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import * as Connections from '@libs/actions/connections/NetSuiteCommands'; | ||
import * as ErrorUtils from '@libs/ErrorUtils'; | ||
import {updateNetSuiteCollectionAccount} from '@libs/actions/connections/NetSuiteCommands'; | ||
import {getLatestErrorField} from '@libs/ErrorUtils'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import {getNetSuiteCollectionAccountOptions, settingsPendingAction} from '@libs/PolicyUtils'; | ||
import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; | ||
import withPolicyConnections from '@pages/workspace/withPolicyConnections'; | ||
import variables from '@styles/variables'; | ||
import * as Policy from '@userActions/Policy/Policy'; | ||
import {clearNetSuiteErrorField} from '@userActions/Policy/Policy'; | ||
import CONST from '@src/CONST'; | ||
import ROUTES from '@src/ROUTES'; | ||
|
||
function NetSuiteCollectionAccountSelectPage({policy}: WithPolicyConnectionsProps) { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
|
||
const policyID = policy?.id ?? '-1'; | ||
const policyID = policy?.id ?? `${CONST.DEFAULT_NUMBER_ID}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we shouldn't default this value anymore - https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#default-value-for-inexistent-ids - "To address both problems, string IDs should not have a default value." |
||
|
||
const config = policy?.connections?.netsuite.options.config; | ||
const config = policy?.connections?.netsuite?.options.config; | ||
const netsuiteCollectionAccountOptions = useMemo<SelectorType[]>( | ||
() => getNetSuiteCollectionAccountOptions(policy ?? undefined, config?.collectionAccount), | ||
[config?.collectionAccount, policy], | ||
|
@@ -36,7 +36,7 @@ function NetSuiteCollectionAccountSelectPage({policy}: WithPolicyConnectionsProp | |
const updateCollectionAccount = useCallback( | ||
({value}: SelectorType) => { | ||
if (config?.collectionAccount !== value) { | ||
Connections.updateNetSuiteCollectionAccount(policyID, value, config?.collectionAccount); | ||
updateNetSuiteCollectionAccount(policyID, value, config?.collectionAccount); | ||
} | ||
Navigation.goBack(ROUTES.POLICY_ACCOUNTING_NETSUITE_ADVANCED.getRoute(policyID)); | ||
}, | ||
|
@@ -83,9 +83,9 @@ function NetSuiteCollectionAccountSelectPage({policy}: WithPolicyConnectionsProp | |
connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} | ||
shouldBeBlocked={config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY} | ||
pendingAction={settingsPendingAction([CONST.NETSUITE_CONFIG.COLLECTION_ACCOUNT], config?.pendingFields)} | ||
errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.COLLECTION_ACCOUNT)} | ||
errors={getLatestErrorField(config, CONST.NETSUITE_CONFIG.COLLECTION_ACCOUNT)} | ||
errorRowStyles={[styles.ph5, styles.pv3]} | ||
onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.COLLECTION_ACCOUNT)} | ||
onClose={() => clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.COLLECTION_ACCOUNT)} | ||
/> | ||
); | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.