mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: safe takopedai sort
This commit is contained in:
1 parent
f0fc23712a
commit
5bf9f8ca9e
6 files changed
+22
-21
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { produce } from 'immer';
|
||||
import { create } from 'zustand';
|
||||
'use client';
|
||||
|
||||
import { createNextSafeStore } from '../core/zustand/createNextSafeStore';
|
||||
import { TankopediaSortBy, TankopediaSortDirection } from './tankopedia';
|
||||
|
||||
export interface TankopediaSort {
|
||||
@@ -7,11 +8,8 @@ export interface TankopediaSort {
|
||||
direction: TankopediaSortDirection;
|
||||
}
|
||||
|
||||
export const useTankopediaSort = create<TankopediaSort>()(() => ({
|
||||
by: 'meta.none',
|
||||
direction: 'descending',
|
||||
}));
|
||||
|
||||
export function mutateTankopediaSort(recipe: (draft: TankopediaSort) => void) {
|
||||
useTankopediaSort.setState(produce(recipe));
|
||||
}
|
||||
export const { Provider, use, useMutation, useStore } =
|
||||
createNextSafeStore<TankopediaSort>({
|
||||
by: 'meta.none',
|
||||
direction: 'descending',
|
||||
});
|
||||
Reference in new issue
Block a user