Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent default filters from being overwritten #562

Merged
merged 3 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/triage.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Triage PR

on:
pull_request:
pull_request_target:
types:
- opened
- edited
Expand Down
32 changes: 15 additions & 17 deletions src/renderer/routes/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Button from '@atlaskit/button/new';
import Checkbox from '@atlaskit/checkbox';
import Heading from '@atlaskit/heading';
import { Box, Inline, Stack } from '@atlaskit/primitives';
import Tooltip from '@atlaskit/tooltip';

import { Contents } from '../components/primitives/Contents';
import { Footer } from '../components/primitives/Footer';
Expand Down Expand Up @@ -51,8 +50,9 @@ export const FiltersRoute: FC = () => {
timeSensitive: TimeSensitiveFilterType,
checked: boolean,
) => {
let timeSensitives: TimeSensitiveFilterType[] =
settings.filterTimeSensitive;
let timeSensitives: TimeSensitiveFilterType[] = [
...settings.filterTimeSensitive,
];

if (checked) {
timeSensitives.push(timeSensitive);
Expand All @@ -71,7 +71,7 @@ export const FiltersRoute: FC = () => {
category: CategoryFilterType,
checked: boolean,
) => {
let categories: CategoryFilterType[] = settings.filterCategories;
let categories: CategoryFilterType[] = [...settings.filterCategories];

if (checked) {
categories.push(category);
Expand All @@ -90,7 +90,7 @@ export const FiltersRoute: FC = () => {
readState: ReadStateFilterType,
checked: boolean,
) => {
let readStates: ReadStateFilterType[] = settings.filterReadStates;
let readStates: ReadStateFilterType[] = [...settings.filterReadStates];

if (checked) {
readStates.push(readState);
Expand All @@ -106,7 +106,7 @@ export const FiltersRoute: FC = () => {
};

const updateProductFilter = (product: ProductName, checked: boolean) => {
let products: ProductName[] = settings.filterProducts;
let products: ProductName[] = [...settings.filterProducts];

if (checked) {
products.push(product);
Expand Down Expand Up @@ -324,17 +324,15 @@ export const FiltersRoute: FC = () => {
</Contents>

<Footer justify="end">
<Tooltip content="Clear all filters" position="left">
<Button
title="Clear Filters"
onClick={clearFilters}
appearance="discovery"
spacing="compact"
testId="filters-clear"
>
Clear Filters
</Button>
</Tooltip>
<Button
title="Clear Filters"
onClick={clearFilters}
appearance="discovery"
spacing="compact"
testId="filters-clear"
>
Clear Filters
</Button>
</Footer>
</Page>
);
Expand Down
75 changes: 26 additions & 49 deletions src/renderer/routes/__snapshots__/Filters.test.tsx.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading