-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 App show error when open unlink in Desktop App #23738
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
625adbe
Should not open unlink in desktop
hoangzinh 9e7114f
Fix unable to unlink due to translation error
hoangzinh 870c013
Fix linter
hoangzinh 16feab4
Remove unused util
hoangzinh 1e4cba6
Change the regex const to CONST
hoangzinh 361f9bb
Merge branch 'main' into df/19681_2
hoangzinh a1bf7f3
Update comment why unlink is in the list
hoangzinh 6f37650
Show full screen loading until the request is completed
hoangzinh 2bcd9f5
Fix linter
hoangzinh 4e1067f
Merge branch 'main' into df/19681_2
hoangzinh 3f35a3d
Fix merge conflict
hoangzinh f9b8d0e
Fix linter
hoangzinh d9586c9
Group early exit conditions
hoangzinh befda6d
Revert using useMemo
hoangzinh 21f34cc
Refactor code
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 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 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 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 |
---|---|---|
@@ -1,31 +1,60 @@ | ||
import React from 'react'; | ||
import React, {useEffect} from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import lodashGet from 'lodash/get'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import {propTypes as validateLinkPropTypes, defaultProps as validateLinkDefaultProps} from './ValidateLoginPage/validateLinkPropTypes'; | ||
import FullScreenLoadingIndicator from '../components/FullscreenLoadingIndicator'; | ||
import Navigation from '../libs/Navigation/Navigation'; | ||
import * as Session from '../libs/actions/Session'; | ||
import ROUTES from '../ROUTES'; | ||
import usePrevious from '../hooks/usePrevious'; | ||
import ONYXKEYS from '../ONYXKEYS'; | ||
|
||
const propTypes = { | ||
/** The accountID and validateCode are passed via the URL */ | ||
route: validateLinkPropTypes, | ||
|
||
/** The details about the account that the user is signing in with */ | ||
account: PropTypes.shape({ | ||
/** Whether a sign is loading */ | ||
isLoading: PropTypes.bool, | ||
}), | ||
}; | ||
|
||
const defaultProps = { | ||
route: validateLinkDefaultProps, | ||
account: { | ||
isLoading: false, | ||
}, | ||
}; | ||
|
||
function UnlinkLoginPage(props) { | ||
const accountID = lodashGet(props.route.params, 'accountID', ''); | ||
const validateCode = lodashGet(props.route.params, 'validateCode', ''); | ||
const prevIsLoading = usePrevious(props.account.isLoading); | ||
|
||
useEffect(() => { | ||
Session.unlinkLogin(accountID, validateCode); | ||
// We only want this to run on mount | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
|
||
useEffect(() => { | ||
// Only navigate when the unlink login request is completed | ||
if (!prevIsLoading || props.account.isLoading) { | ||
return; | ||
} | ||
|
||
Navigation.navigate(ROUTES.HOME); | ||
}, [prevIsLoading, props.account.isLoading]); | ||
|
||
Session.unlinkLogin(accountID, validateCode); | ||
Navigation.navigate(ROUTES.HOME); | ||
return <FullScreenLoadingIndicator />; | ||
} | ||
|
||
UnlinkLoginPage.propTypes = propTypes; | ||
UnlinkLoginPage.defaultProps = defaultProps; | ||
UnlinkLoginPage.displayName = 'UnlinkLoginPage'; | ||
|
||
export default UnlinkLoginPage; | ||
export default withOnyx({ | ||
account: {key: ONYXKEYS.ACCOUNT}, | ||
})(UnlinkLoginPage); |
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.
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.
Hey, this line caused a bug - #36618
RCA is here.