Fix outdated selected languages in selection dialog

When directly opening the source/extension browse page as the initial page, the metadata server settings weren't loaded yet, and thus, the default values were being used.
Thus, when opening the dialog the first time, it was showing the default selected languages.
This commit is contained in:
schroda
2026-04-27 13:58:31 +02:00
parent 89e0b0761e
commit a7dcdd5651
3 changed files with 14 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- (**Library**) Fix total library size chip color in light mode - (**Library**) Fix total library size chip color in light mode
- (**Browse**) Fix missing pinned sources in the source language filter - (**Browse**) Fix missing pinned sources in the source language filter
- (**Browse**) Fix incorrectly showing "local source" source in the source language filter (the local source can't be disabled) - (**Browse**) Fix incorrectly showing "local source" source in the source language filter (the local source can't be disabled)
- (**Browse**) Fix language selection showing the default selected languages when the source/extension page was the first opened page
- (**Reader**) Fix page shift when toggling the "offset double spreads" setting (currently: enable: shift to the right; disable: shift to the left now: inverted) - (**Reader**) Fix page shift when toggling the "offset double spreads" setting (currently: enable: shift to the right; disable: shift to the left now: inverted)
- (**Reader**) Fix "auto webtoon mode" detection for manga source languages other than english and the current selected language - (**Reader**) Fix "auto webtoon mode" detection for manga source languages other than english and the current selected language
- (**Reader**) Fix the reader transition page previous chapter scanlator name showing the chapter name instead of the scanlator name - (**Reader**) Fix the reader transition page previous chapter scanlator name showing the chapter name instead of the scanlator name

View File

@@ -22,6 +22,7 @@ import { useLingui } from '@lingui/react/macro';
import { CustomTooltip } from '@/base/components/CustomTooltip.tsx'; import { CustomTooltip } from '@/base/components/CustomTooltip.tsx';
import { translateExtensionLanguage } from '@/features/extension/Extensions.utils.ts'; import { translateExtensionLanguage } from '@/features/extension/Extensions.utils.ts';
import { languageSortComparator, toUniqueLanguageCodes } from '@/base/utils/Languages.ts'; import { languageSortComparator, toUniqueLanguageCodes } from '@/base/utils/Languages.ts';
import { usePrevious } from '@mantine/hooks';
interface IProps { interface IProps {
selectedLanguages: string[]; selectedLanguages: string[];
@@ -35,6 +36,12 @@ export function LanguageSelect({ selectedLanguages, setSelectedLanguages, langua
const [tmpSelectedLanguages, setTmpSelectedLanguages] = useState(toUniqueLanguageCodes(selectedLanguages)); const [tmpSelectedLanguages, setTmpSelectedLanguages] = useState(toUniqueLanguageCodes(selectedLanguages));
const [open, setOpen] = useState<boolean>(false); const [open, setOpen] = useState<boolean>(false);
const previousSelectedLanguages = usePrevious(selectedLanguages);
if (previousSelectedLanguages && previousSelectedLanguages !== selectedLanguages) {
setTmpSelectedLanguages(toUniqueLanguageCodes(selectedLanguages));
}
const languagesSortedBySelectState = useMemo( const languagesSortedBySelectState = useMemo(
() => () =>
toUniqueLanguageCodes([ toUniqueLanguageCodes([

View File

@@ -40,6 +40,7 @@ import { ListCardAvatar } from '@/base/components/lists/cards/ListCardAvatar.tsx
import { makeToast } from '@/base/utils/Toast.ts'; import { makeToast } from '@/base/utils/Toast.ts';
import { getErrorMessage } from '@/lib/HelperFunctions.ts'; import { getErrorMessage } from '@/lib/HelperFunctions.ts';
import { VirtuosoUtil } from '@/lib/virtuoso/Virtuoso.util.tsx'; import { VirtuosoUtil } from '@/lib/virtuoso/Virtuoso.util.tsx';
import { usePrevious } from '@mantine/hooks';
export const SourceLanguageSelect = ({ export const SourceLanguageSelect = ({
selectedLanguages, selectedLanguages,
@@ -64,6 +65,11 @@ export const SourceLanguageSelect = ({
const [tmpSelectedLanguages, setTmpSelectedLanguages] = useState(toUniqueLanguageCodes(selectedLanguages)); const [tmpSelectedLanguages, setTmpSelectedLanguages] = useState(toUniqueLanguageCodes(selectedLanguages));
const [open, setOpen] = useState<boolean>(false); const [open, setOpen] = useState<boolean>(false);
const previousSelectedLanguages = usePrevious(selectedLanguages);
if (previousSelectedLanguages && previousSelectedLanguages !== selectedLanguages) {
setTmpSelectedLanguages(toUniqueLanguageCodes(selectedLanguages));
}
const sourcesByLanguage = useMemo(() => Sources.groupByLanguage(sources), [sources]); const sourcesByLanguage = useMemo(() => Sources.groupByLanguage(sources), [sources]);
const languagesSortedBySelectState = useMemo( const languagesSortedBySelectState = useMemo(