Skip to content
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: 20412 new user is not navigating to concierge chat after tab on link #20740

Merged
merged 3 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions src/libs/Navigation/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ const navigationIsReadyPromise = new Promise((resolve) => {
resolveNavigationIsReadyPromise = resolve;
});

let resolveReportScreenIsReadyPromise;
let reportScreenIsReadyPromise = new Promise((resolve) => {
resolveReportScreenIsReadyPromise = resolve;
});

let pendingRoute = null;

/**
Expand Down Expand Up @@ -219,20 +214,6 @@ function setIsNavigationReady() {
resolveNavigationIsReadyPromise();
}

function resetIsReportScreenReadyPromise() {
reportScreenIsReadyPromise = new Promise((resolve) => {
resolveReportScreenIsReadyPromise = resolve;
});
}

function isReportScreenReady() {
return reportScreenIsReadyPromise;
}

function setIsReportScreenIsReady() {
resolveReportScreenIsReadyPromise();
}

export default {
canNavigate,
navigate,
Expand All @@ -244,9 +225,6 @@ export default {
isNavigationReady,
setIsNavigationReady,
getReportIDFromRoute,
resetIsReportScreenReadyPromise,
isReportScreenReady,
setIsReportScreenIsReady,
getTopmostReportId,
};

Expand Down
23 changes: 23 additions & 0 deletions src/libs/SidebarUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,26 @@ Onyx.connect({
callback: (val) => (preferredLocale = val || CONST.LOCALES.DEFAULT),
});

let resolveSidebarIsReadyPromise;

let sidebarIsReadyPromise = new Promise((resolve) => {
resolveSidebarIsReadyPromise = resolve;
});

function resetIsSidebarLoadedReadyPromise() {
sidebarIsReadyPromise = new Promise((resolve) => {
resolveSidebarIsReadyPromise = resolve;
});
}

function isSidebarLoadedReady() {
return sidebarIsReadyPromise;
}

function setIsSidebarLoadedReady() {
resolveSidebarIsReadyPromise();
}

/**
* @param {String} reportIDFromRoute
* @returns {String[]} An array of reportIDs sorted in the proper order
Expand Down Expand Up @@ -349,4 +369,7 @@ function getOptionData(reportID) {
export default {
getOptionData,
getOrderedReportIDs,
setIsSidebarLoadedReady,
isSidebarLoadedReady,
resetIsSidebarLoadedReadyPromise,
};
3 changes: 2 additions & 1 deletion src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import * as CollectionUtils from '../CollectionUtils';
import * as EmojiUtils from '../EmojiUtils';
import * as ErrorUtils from '../ErrorUtils';
import * as Welcome from './Welcome';
import SidebarUtils from '../SidebarUtils';

let currentUserEmail;
let currentUserAccountID;
Expand Down Expand Up @@ -1638,7 +1639,7 @@ function openReportFromDeepLink(url, isAuthenticated) {

// Navigate to the report after sign-in/sign-up.
InteractionManager.runAfterInteractions(() => {
Navigation.isReportScreenReady().then(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point this is not used naywhere else so we can remove it

SidebarUtils.isSidebarLoadedReady().then(() => {
if (reportID) {
Navigation.navigate(ROUTES.getReportRoute(reportID));
}
Expand Down
7 changes: 3 additions & 4 deletions src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ class ReportScreen extends React.Component {

this.fetchReportIfNeeded();
ComposerActions.setShouldShowComposeInput(true);
Navigation.setIsReportScreenIsReady();
}

componentDidUpdate(prevProps) {
Expand All @@ -168,10 +167,10 @@ class ReportScreen extends React.Component {
}

componentWillUnmount() {
if (this.unsubscribeVisibilityListener) {
this.unsubscribeVisibilityListener();
if (!this.unsubscribeVisibilityListener) {
return;
}
Navigation.resetIsReportScreenReadyPromise();
this.unsubscribeVisibilityListener();
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/pages/home/sidebar/SidebarLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,14 @@ class SidebarLinks extends React.Component {

componentDidMount() {
App.setSidebarLoaded();
SidebarUtils.setIsSidebarLoadedReady();
this.isSidebarLoaded = true;
}

componentWillUnmount() {
SidebarUtils.resetIsSidebarLoadedReadyPromise();
}

showSearchPage() {
if (this.props.isCreateMenuOpen) {
// Prevent opening Search page when click Search icon quickly after clicking FAB icon
Expand Down