Copilot commented on code in PR #36893:
URL: https://github.com/apache/superset/pull/36893#discussion_r2662368429
##########
superset-frontend/src/views/index.tsx:
##########
@@ -19,6 +19,19 @@
import 'src/public-path';
import ReactDOM from 'react-dom';
-import App from './App';
+import initPreamble from 'src/preamble';
-ReactDOM.render(<App />, document.getElementById('app'));
+const appMountPoint = document.getElementById('app');
+
+if (appMountPoint) {
+ (async () => {
+ try {
+ await initPreamble();
+ } finally {
+ const { default: App } = await import(
+ /* webpackMode: "eager" */ './App'
+ );
+ ReactDOM.render(<App />, appMountPoint);
+ }
+ })();
Review Comment:
The async IIFE doesn't have a catch block, so if `initPreamble()` throws an
error, it will become an unhandled promise rejection. While the `finally` block
ensures the app still renders, the error should be explicitly caught and logged
for debugging purposes.
Consider adding a catch block to log the error, similar to the error
handling in `preamble.ts` lines 125-127.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]