1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-12-09 20:04:11 +01:00

fix: clearing lifecycle filter when switching to archived view (#10726)

"Lifecycle" filter should never be enabled when viewing archive.
This commit is contained in:
Tymoteusz Czech 2025-10-03 09:29:02 +02:00 committed by GitHub
parent a927f1f42b
commit adada932b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 41 additions and 1 deletions

View File

@ -256,3 +256,40 @@ test('renders lifecycle quick filters', async () => {
await screen.findByText(/Rollout production/);
await screen.findByText(/Cleanup/);
});
test('clears lifecycle filter when switching to archived view', async () => {
setupApi();
testServerRoute(server, '/api/admin/ui-config', {
flags: {
flagCreator: true,
flagsUiFilterRefactor: true,
},
});
render(
<Routes>
<Route
path={'/projects/:projectId'}
element={
<ProjectFeatureToggles
environments={['development', 'production']}
/>
}
/>
</Routes>,
{
route: '/projects/default?lifecycle=IS%3Alive',
},
);
expect(window.location.href).toContain('lifecycle=IS%3Alive');
await screen.findByText('featureA');
const viewArchived = await screen.findByRole('button', {
name: /View archived flags/i,
});
fireEvent.click(viewArchived);
expect(window.location.href).not.toContain('lifecycle=IS%3Alive');
expect(window.location.href).toContain('archived=IS%3Atrue');
});

View File

@ -215,7 +215,10 @@ export const ProjectFeatureToggles = ({
if (showArchived) {
setTableState({ archived: undefined });
} else {
setTableState({ archived: { operator: 'IS', values: ['true'] } });
setTableState({
archived: { operator: 'IS', values: ['true'] },
lifecycle: undefined,
});
}
};
const environments = showArchived ? [] : availableEnvironments;