Compare commits

...

5 Commits

Author SHA1 Message Date
SagarRajput-7
81e9482aaa Merge branch 'main' into sentry-fixes 2026-06-11 18:42:57 +05:30
SagarRajput-7
ed111e10d9 fix(settings): test fixes 2026-06-11 17:16:55 +05:30
SagarRajput-7
bfb8334737 Merge branch 'main' into sentry-fixes 2026-06-11 16:59:16 +05:30
SagarRajput-7
fd2cc3145b fix(settings): guard against non-APIError in logs retention error state 2026-06-11 16:53:41 +05:30
SagarRajput-7
cbef40d209 fix(settings): disable RouteTab tab panel animation to prevent insertBefore crash 2026-06-11 16:37:28 +05:30
4 changed files with 56 additions and 2 deletions

View File

@@ -74,6 +74,17 @@ describe('RouteTab component', () => {
expect(history.location.pathname).toBe('/tab2');
});
it('does not animate tab panels to prevent CSSMotion DOM corruption', () => {
const history = createMemoryHistory();
const { container } = render(
<Router history={history}>
<RouteTab history={history} routes={testRoutes} activeKey="Tab1" />
</Router>,
);
const tabContent = container.querySelector('.ant-tabs-content');
expect(tabContent).not.toHaveClass('ant-tabs-content-animated');
});
it('calls onChangeHandler on tab change', () => {
const onChangeHandler = jest.fn();
const history = createMemoryHistory();

View File

@@ -59,7 +59,7 @@ function RouteTab({
destroyInactiveTabPane
activeKey={currentRoute?.key || activeKey}
defaultActiveKey={currentRoute?.key || activeKey}
animated
animated={{ inkBar: true, tabPane: false }}
items={items}
tabBarExtraContent={
showRightSection && (

View File

@@ -0,0 +1,41 @@
import { useQueries } from 'react-query';
import { render, screen } from 'tests/test-utils';
import GeneralSettings from '../index';
jest.mock('react-query', () => ({
...jest.requireActual('react-query'),
useQueries: jest.fn(),
}));
const baseQueryResult = {
isError: false,
isLoading: false,
isFetching: false,
isSuccess: true,
data: undefined,
error: null,
refetch: jest.fn(),
};
describe('GeneralSettings index', () => {
it('renders fallback message when logs query fails with a non-APIError', () => {
(useQueries as jest.Mock).mockReturnValue([
{ ...baseQueryResult },
{ ...baseQueryResult },
{
...baseQueryResult,
isError: true,
isSuccess: false,
error: new TypeError(
"Cannot read properties of undefined (reading 'code')",
),
},
{ ...baseQueryResult },
]);
render(<GeneralSettings />);
expect(screen.getByText('something_went_wrong')).toBeInTheDocument();
});
});

View File

@@ -76,7 +76,9 @@ function GeneralSettings(): JSX.Element {
if (getRetentionPeriodLogsApiResponse.isError || getDisksResponse.isError) {
return (
<Typography>
{(getRetentionPeriodLogsApiResponse.error as APIError).getErrorMessage() ||
{(getRetentionPeriodLogsApiResponse.error instanceof APIError
? getRetentionPeriodLogsApiResponse.error.getErrorMessage()
: undefined) ||
getDisksResponse.data?.error ||
t('something_went_wrong')}
</Typography>