Browse Source

feat(ui): Enable react concurrent mode (#70071)

Scott Cooper 10 months ago
parent
commit
9a31bb0dc5

+ 2 - 7
static/app/bootstrap/initializeSdk.tsx

@@ -234,7 +234,7 @@ export function initializeSdk(config: Config, {routes}: {routes?: Function} = {}
     Sentry.setTag('sentry_version', window.__SENTRY__VERSION);
   }
 
-  const {customerDomain, features} = window.__initialData;
+  const {customerDomain} = window.__initialData;
 
   if (customerDomain) {
     Sentry.setTag('isCustomerDomain', 'yes');
@@ -244,12 +244,7 @@ export function initializeSdk(config: Config, {routes}: {routes?: Function} = {}
   }
 
   // TODO: Remove once we've finished rolling out the new renderer
-  Sentry.setTag(
-    'isConcurrentRenderer',
-    (features as unknown as string[])?.includes(
-      'organizations:react-concurrent-renderer-enabled'
-    ) ?? false
-  );
+  Sentry.setTag('isConcurrentRenderer', true);
 }
 
 export function isFilteredRequestErrorEvent(event: Event): boolean {

+ 2 - 17
static/app/bootstrap/renderDom.tsx

@@ -1,8 +1,5 @@
-import {render} from 'react-dom';
 import {createRoot} from 'react-dom/client';
 
-import {USE_REACT_CONCURRENT_MODE} from 'sentry/constants';
-
 export function renderDom(
   Component: React.ComponentType,
   container: string,
@@ -16,18 +13,6 @@ export function renderDom(
     return;
   }
 
-  // Types are for ConfigStore, the window object is from json and features is not a Set
-  if (
-    (window.__initialData.features as unknown as string[]).includes(
-      'organizations:react-concurrent-renderer-enabled'
-    ) ||
-    USE_REACT_CONCURRENT_MODE
-  ) {
-    // Enable concurrent rendering
-    const root = createRoot(rootEl);
-    root.render(<Component {...props} />);
-  } else {
-    // Legacy rendering
-    render(<Component {...props} />, rootEl);
-  }
+  const root = createRoot(rootEl);
+  root.render(<Component {...props} />);
 }

+ 3 - 16
static/app/bootstrap/renderPipelineView.tsx

@@ -1,27 +1,14 @@
-import {render} from 'react-dom';
 import {createRoot} from 'react-dom/client';
 
-import {ROOT_ELEMENT, USE_REACT_CONCURRENT_MODE} from 'sentry/constants';
+import {ROOT_ELEMENT} from 'sentry/constants';
 import type {PipelineInitialData} from 'sentry/types/system';
 import PipelineView from 'sentry/views/integrationPipeline/pipelineView';
 
 function renderDom(pipelineName: string, props: PipelineInitialData['props']) {
   const rootEl = document.getElementById(ROOT_ELEMENT)!;
 
-  // Types are for ConfigStore, the window object is from json and features is not a Set
-  if (
-    (window.__initialData.features as unknown as string[]).includes(
-      'organizations:react-concurrent-renderer-enabled'
-    ) ||
-    USE_REACT_CONCURRENT_MODE
-  ) {
-    // Enable concurrent rendering
-    const root = createRoot(rootEl);
-    root.render(<PipelineView pipelineName={pipelineName} {...props} />);
-  } else {
-    // Legacy rendering
-    render(<PipelineView pipelineName={pipelineName} {...props} />, rootEl);
-  }
+  const root = createRoot(rootEl);
+  root.render(<PipelineView pipelineName={pipelineName} {...props} />);
 }
 
 export function renderPipelineView() {

+ 0 - 1
static/app/constants/index.tsx

@@ -378,7 +378,6 @@ export const SPA_DSN = process.env.SPA_DSN;
 export const SENTRY_RELEASE_VERSION = process.env.SENTRY_RELEASE_VERSION;
 export const UI_DEV_ENABLE_PROFILING = process.env.UI_DEV_ENABLE_PROFILING;
 export const USE_REACT_QUERY_DEVTOOL = process.env.USE_REACT_QUERY_DEVTOOL;
-export const USE_REACT_CONCURRENT_MODE = process.env.USE_REACT_CONCURRENT_MODE;
 
 export const DEFAULT_ERROR_JSON = {
   detail: t('Unknown error. Please try again.'),

+ 0 - 5
webpack.config.ts

@@ -67,10 +67,6 @@ const CONTROL_SILO_PORT = env.SENTRY_CONTROL_SILO_PORT;
 // features in the Sentry UI.
 const USE_REACT_QUERY_DEVTOOL = !!env.USE_REACT_QUERY_DEVTOOL;
 
-// Enable react 18 concurrent mode
-const USE_REACT_CONCURRENT_MODE =
-  (DEV_MODE || IS_ACCEPTANCE_TEST) && !env.DISABLE_REACT_CONCURRENT_MODE;
-
 // Environment variables that are used by other tooling and should
 // not be user configurable.
 //
@@ -360,7 +356,6 @@ const appConfig: Configuration = {
         SPA_DSN: JSON.stringify(SENTRY_SPA_DSN),
         SENTRY_RELEASE_VERSION: JSON.stringify(SENTRY_RELEASE_VERSION),
         USE_REACT_QUERY_DEVTOOL: JSON.stringify(USE_REACT_QUERY_DEVTOOL),
-        USE_REACT_CONCURRENT_MODE: JSON.stringify(USE_REACT_CONCURRENT_MODE),
       },
     }),