From b9d4c391fe5e84bb5092ec87c57b1d3949e98c1e Mon Sep 17 00:00:00 2001
From: tresabhi <43380238+tresabhi@users.noreply.github.com>
Date: Tue, 12 Nov 2024 21:11:48 -0600
Subject: [PATCH] fix: search page reset button resets the sort too now
---
.../src/components/TankSearch/components/FilterControl.tsx | 5 +++++
packages/website/src/stores/tankopediaSort.ts | 6 ++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/packages/website/src/components/TankSearch/components/FilterControl.tsx b/packages/website/src/components/TankSearch/components/FilterControl.tsx
index a9c9ebd54..a8047e6fc 100644
--- a/packages/website/src/components/TankSearch/components/FilterControl.tsx
+++ b/packages/website/src/components/TankSearch/components/FilterControl.tsx
@@ -11,6 +11,10 @@ import { ReloadIcon } from '@radix-ui/react-icons';
import { Box, Flex, IconButton, Text } from '@radix-ui/themes';
import { times } from 'lodash-es';
import { $tankFilters, initialTankFilters } from '../../../stores/tankFilters';
+import {
+ $tankopediaSort,
+ initialTankopediaSort,
+} from '../../../stores/tankopediaSort';
import { classIcons } from '../../ClassIcon';
import { ExperimentIcon } from '../../ExperimentIcon';
import { GunAutoloaderIcon } from '../../GunAutoloaderIcon';
@@ -441,6 +445,7 @@ export function FilterControl({ compact }: FilterControlProps) {
color="red"
onClick={() => {
$tankFilters.set(initialTankFilters);
+ $tankopediaSort.set(initialTankopediaSort);
}}
>
diff --git a/packages/website/src/stores/tankopediaSort.ts b/packages/website/src/stores/tankopediaSort.ts
index 986fe7ddf..edf28d1ca 100644
--- a/packages/website/src/stores/tankopediaSort.ts
+++ b/packages/website/src/stores/tankopediaSort.ts
@@ -9,7 +9,9 @@ export interface TankopediaSort {
direction: TankopediaSortDirection;
}
-export const $tankopediaSort = map({
+export const initialTankopediaSort: TankopediaSort = {
by: 'meta.none',
direction: 'descending',
-});
+};
+
+export const $tankopediaSort = map(initialTankopediaSort);