fix: trigger library update for the books counter after importing books (#1336)

This commit is contained in:
Huang Xin
2025-06-05 01:02:49 +08:00
committed by GitHub
parent db955d2c8c
commit 2a26f8b04a
2 changed files with 3 additions and 9 deletions
+1 -1
View File
@@ -366,7 +366,7 @@ const LibraryPageContent = ({ searchParams }: { searchParams: ReadonlyURLSearchP
for (const file of files) {
try {
const book = await appService?.importBook(file, library);
setLibrary(library);
setLibrary([...library]);
if (user && book && !book.uploadedAt && settings.autoUpload) {
console.log('Uploading book:', book.title);
handleBookUpload(book);
@@ -62,6 +62,7 @@ export const UpdaterContent = ({ version }: { version?: string }) => {
const _ = useTranslation();
const [targetLang, setTargetLang] = useState('EN');
const { translate } = useTranslator({
provider: 'azure',
sourceLang: 'AUTO',
targetLang,
});
@@ -79,14 +80,7 @@ export const UpdaterContent = ({ version }: { version?: string }) => {
const [downloaded, setDownloaded] = useState<number | null>(null);
useEffect(() => {
const locale = getLocale();
let userLang = locale.split('-')[0] || 'en';
if (locale === 'zh-CN') {
userLang = 'zh-Hans';
} else if (locale.startsWith('zh')) {
userLang = 'zh-Hant';
}
setTargetLang(userLang.toUpperCase());
setTargetLang(getLocale());
}, []);
useEffect(() => {