#760 - Fix to keep locale filter

This commit is contained in:
Elio Struyf
2024-02-22 10:29:51 +01:00
parent 241e660694
commit b1e87d4f57
+11 -10
View File
@@ -220,16 +220,6 @@ export default function usePages(pages: Page[]) {
}
}
if (tabPrevious !== tab || !locales || locales.length === 0) {
// Store the locale information
const config: I18nConfig[] = [];
crntPages.forEach((page) => {
if (page.fmLocale && !config.some(locale => locale.locale === page.fmLocale?.locale)) {
config.push(page.fmLocale);
}
});
setLocales(config);
}
// Set the pages
setPageItems(crntPages);
@@ -276,6 +266,17 @@ export default function usePages(pages: Page[]) {
} else {
startPageProcessing();
}
if (pages && pages.length > 0) {
// Store the locale information
const config: I18nConfig[] = [];
pages.forEach((page) => {
if (page.fmLocale && !config.some(locale => locale.locale === page.fmLocale?.locale)) {
config.push(page.fmLocale);
}
});
setLocales(config);
}
}, [settings?.draftField, pages, sorting, search, tag, category, locale, filters, folder]);
useEffect(() => {