forked from akai/readest
fix: trigger library update for the books counter after importing books (#1336)
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user