PromucFlow_constructor/app/client/src/index.tsx
Diljit 7239cdd134
chore: refactor faro (CE) (#40350)
## Description
> [!TIP]  
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags="@tag.All"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/14664226456>
> Commit: caaee4bf1801f63845044e1d0870fd50e853bf3a
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14664226456&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Fri, 25 Apr 2025 13:20:56 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Unified all error and telemetry reporting to use a centralized
telemetry utility for improved consistency.
- Replaced legacy error reporting imports and methods with a new
singleton telemetry interface across the application.
  - Removed obsolete telemetry and error reporting files and classes.
- Simplified telemetry initialization by removing conditional tracing
checks.
  - No changes to user-facing functionality or workflows.

- **Tests**
  - Updated test mocks to use the new telemetry interface.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Apeksha Bhosale <7846888+ApekshaBhosale@users.noreply.github.com>
2025-04-29 10:32:36 +05:30

88 lines
2.6 KiB
TypeScript
Executable File

// This file must be executed as early as possible to ensure the preloads are triggered ASAP
import "./preload-route-chunks";
// Initialise eval worker instance
import "utils/workerInstances";
import React from "react";
import "./wdyr";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import "./index.css";
import "@appsmith/ads-old/src/themes/default/index.css";
import "@appsmith/ads/src/__theme__/default/index.css";
import { ThemeProvider } from "styled-components";
import { appInitializer } from "utils/AppUtils";
import store, { runSagaMiddleware } from "./store";
import { LayersContext, Layers } from "constants/Layers";
import AppRouter from "ee/AppRouter";
import { getCurrentThemeDetails } from "selectors/themeSelectors";
import { connect } from "react-redux";
import type { AppState } from "ee/reducers";
import { Toast } from "@appsmith/ads";
import "./assets/styles/index.css";
import "./polyfills";
import GlobalStyles from "globalStyles";
// enable autofreeze only in development
import AppErrorBoundary from "./AppErrorBoundry";
import log from "loglevel";
import { FaroErrorBoundary } from "@grafana/faro-react";
runSagaMiddleware();
appInitializer();
(async () => {
try {
await import(/* webpackChunkName: "instrumentation" */ "./instrumentation");
} catch (e) {
log.error("Error loading telemetry script", e);
}
})();
function App() {
return (
<FaroErrorBoundary fallback={<div>An error has occured</div>}>
<Provider store={store}>
<LayersContext.Provider value={Layers}>
<ThemedAppWithProps />
</LayersContext.Provider>
</Provider>
</FaroErrorBoundary>
);
}
class ThemedApp extends React.Component<{
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
currentTheme: any;
}> {
render() {
return (
<ThemeProvider theme={this.props.currentTheme}>
<Toast />
<GlobalStyles />
<AppErrorBoundary>
<AppRouter />
</AppErrorBoundary>
</ThemeProvider>
);
}
}
const mapStateToProps = (state: AppState) => ({
currentTheme: getCurrentThemeDetails(state),
});
const ThemedAppWithProps = connect(mapStateToProps)(ThemedApp);
ReactDOM.render(<App />, document.getElementById("root"));
// expose store when run in Cypress
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if ((window as any).Cypress) {
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(window as any).store = store;
}