Fix reset of reader store

After the slice states got reset, the base reset function just reverted all those resets and only reset the base states in the store (manga, scrollbar, ...)
This commit is contained in:
schroda
2025-09-22 00:07:57 +02:00
parent 4a07198af6
commit f6b94c838b
8 changed files with 44 additions and 35 deletions

View File

@@ -12,7 +12,7 @@ import { requestManager } from '@/lib/requests/RequestManager.ts';
export interface ReaderPagesStoreSlice {
pages: ReaderStatePages & {
reset: () => void;
reset: () => ReaderPagesStoreSlice;
};
}
@@ -52,7 +52,7 @@ export const createReaderPagesStoreSlice = <T extends ReaderPagesStoreSlice>(
): ReaderPagesStoreSlice => ({
pages: {
...READER_DEFAULT_PAGES_STATE,
reset: () => set(() => ({ pages: { ...get().pages, ...READER_DEFAULT_PAGES_STATE } })),
reset: () => ({ pages: { ...get().pages, ...READER_DEFAULT_PAGES_STATE } }),
setCurrentPageIndex: (index) =>
set((draft) => {
draft.pages.currentPageIndex = index;