PromucFlow_constructor/app/client/src/pages/Applications/loader.tsx
ChandanBalajiBP 24a1ff88cb
fix: Error navigation blockers (#22291)
## Description

> Remove debugger from preview mode
> Remove debugger in welcome tour
> Don't open debugger on `onpageload` action.


Fixes #22283 
#22281 
#22275 

## Type of change

> Please delete options that are not relevant.

- Bug fix (non-breaking change which fixes an issue)


## How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Provide
instructions, so we can reproduce.
> Please also list any relevant details for your test configuration.
> Delete anything that is not important

- Manual
- Cypress

## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-04-12 22:38:55 +05:30

48 lines
1.4 KiB
TypeScript

import React from "react";
import PageLoadingBar from "pages/common/PageLoadingBar";
import { retryPromise } from "utils/AppsmithUtils";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import AnalyticsUtil from "utils/AnalyticsUtil";
import { connect } from "react-redux";
import { showDebugger } from "actions/debuggerActions";
class ApplicationListLoader extends React.PureComponent<any, { Page: any }> {
constructor(props: any) {
super(props);
this.state = {
Page: null,
};
}
componentDidMount() {
//Close debugger call is required because if we import the application page with debugger open
//it will cause a debugger to open. issue #21xxx
this.props.closeDebugger();
PerformanceTracker.stopTracking(PerformanceTransactionName.LOGIN_CLICK);
AnalyticsUtil.logEvent("APPLICATIONS_PAGE_LOAD");
retryPromise(
() =>
import(
/* webpackChunkName: "applications" */ "@appsmith/pages/Applications/index"
),
).then((module) => {
this.setState({ Page: module.default });
});
}
render() {
const { Page } = this.state;
return Page ? <Page {...this.props} /> : <PageLoadingBar />;
}
}
const mapDispatchToProps = (dispatch: any) => ({
closeDebugger: () => dispatch(showDebugger(false)),
});
export default connect(null, mapDispatchToProps)(ApplicationListLoader);