bito-code-review[bot] commented on PR #43454:
URL: https://github.com/apache/superset/pull/43454#issuecomment-5394687375
<!-- Bito Reply -->
The flagged issue is correct. When the number of result panes decreases, the
`activeTabKey` can point to a key that no longer exists in the `items` array,
causing the `Tabs` component to render blank. To resolve this, you should
validate that `activeTabKey` exists in the current `items` and fall back to a
default key (e.g., `ResultTypes.Results`) if it does not.
Here is a suggested fix:
```tsx
const activeKeyExists = items.some(item => item.key === activeTabKey);
const safeActiveKey = activeKeyExists ? activeTabKey : ResultTypes.Results;
return (
<Wrapper>
<Tabs
fullHeight
activeKey={safeActiveKey}
onChange={setActiveTabKey}
items={items}
/>
</Wrapper>
);
```
There are no other comments on this PR to address. Would you like me to
perform any other analysis?
**superset-frontend/src/explore/components/DataTablesPane/components/ResultsPaneOnDashboard.tsx**
```
const activeKeyExists = items.some(item => item.key === activeTabKey);
const safeActiveKey = activeKeyExists ? activeTabKey : ResultTypes.Results;
return (
<Wrapper>
<Tabs
fullHeight
activeKey={safeActiveKey}
onChange={setActiveTabKey}
items={items}
/>
</Wrapper>
);
```
--
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]