codeant-ai-for-open-source[bot] commented on code in PR #42143:
URL: https://github.com/apache/superset/pull/42143#discussion_r3614070974
##########
superset-frontend/src/views/App.tsx:
##########
@@ -214,15 +218,26 @@ const AppContent = () => {
);
};
-const App = () => (
- <Router basename={applicationRoot()}>
- <ScrollToTop />
- <LocationPathnameLogger />
- <RootContextProviders>
- <AppContent />
- <ToastContainer />
- </RootContextProviders>
- </Router>
-);
+const App = () => {
+ const layoutPortalNode = useMemo(() => createHtmlPortalNode(), []);
+
+ return (
+ <Router basename={applicationRoot()}>
+ <ScrollToTop />
+ <LocationPathnameLogger />
+ <RootContextProviders>
+ <InPortal node={layoutPortalNode}>
+ <Layout css={layoutCss}>
+ <Layout.Content css={contentCss}>
+ <RouteSwitch />
+ </Layout.Content>
+ </Layout>
+ </InPortal>
+ <AppContent />
Review Comment:
Yes — this comment is correct.
`AppContent` now expects `layoutPortalNode`, but `App` still renders it as:
```tsx
<AppContent />
```
So `layoutPortalNode` will be `undefined`, which means `<OutPortal
node={layoutPortalNode} />` won’t be able to attach to the portal node, and
TypeScript should also flag the missing required prop.
### Minimal fix
Pass the same memoized node into `AppContent`:
```tsx
<AppContent layoutPortalNode={layoutPortalNode} />
```
That keeps `InPortal` and `OutPortal` wired to the same portal node and
preserves the intended “render once, move it around” behavior.
### Conclusion
This is a real issue, not a false positive. The fix is small and required
for both type safety and runtime correctness.
If you want, I can also review the rest of the comments on this PR.
--
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]