Simplify selecting zustand store state

This commit is contained in:
schroda
2026-03-11 22:10:34 +01:00
parent 72af9d52d1
commit 1cccd1ea46
24 changed files with 154 additions and 135 deletions

View File

@@ -49,14 +49,12 @@ const BaseReader = ({
readerNavBarWidth,
}: Pick<NavbarContextType, 'setOverride' | 'readerNavBarWidth'>) => {
const { t } = useLingui();
const manga = useReaderStore((state) => state.manga);
const manga = useReaderStore('manga');
const { mangaChapters, initialChapter, chapterForDuplicatesHandling, currentChapter } = useReaderChaptersStore(
(state) => ({
mangaChapters: state.mangaChapters,
initialChapter: state.initialChapter,
chapterForDuplicatesHandling: state.chapterForDuplicatesHandling,
currentChapter: state.currentChapter,
}),
'mangaChapters',
'initialChapter',
'chapterForDuplicatesHandling',
'currentChapter',
);
const {
shouldSkipDupChapters,
@@ -67,16 +65,16 @@ const BaseReader = ({
tapZoneInvertMode,
shouldShowReadingModePreview,
shouldShowTapZoneLayoutPreview,
} = useReaderSettingsStore((state) => ({
shouldSkipDupChapters: state.shouldSkipDupChapters,
shouldSkipFilteredChapters: state.shouldSkipFilteredChapters,
backgroundColor: state.backgroundColor,
readingMode: state.readingMode,
tapZoneLayout: state.tapZoneLayout,
tapZoneInvertMode: state.tapZoneInvertMode,
shouldShowReadingModePreview: state.shouldShowReadingModePreview,
shouldShowTapZoneLayoutPreview: state.shouldShowTapZoneLayoutPreview,
}));
} = useReaderSettingsStore(
'shouldSkipDupChapters',
'shouldSkipFilteredChapters',
'backgroundColor',
'readingMode',
'tapZoneLayout',
'tapZoneInvertMode',
'shouldShowReadingModePreview',
'shouldShowTapZoneLayoutPreview',
);
const scrollElementRef = useRef<HTMLDivElement | null>(null);