mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
fix: add @typescript-eslint/no-floating-promises rule (#2764)
Co-authored-by: himself65 <himself65@outlook.com>
This commit is contained in:
@@ -49,7 +49,9 @@ export const updateAvailableAtom = atomWithObservable(() => {
|
||||
return rpcToObservable(null as any | null, {
|
||||
event: window.events?.updater.onUpdateAvailable,
|
||||
onSubscribe: () => {
|
||||
window.apis?.updater.checkForUpdatesAndNotify();
|
||||
window.apis?.updater.checkForUpdatesAndNotify().catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -65,7 +65,10 @@ export function AppUpdaterButton({ className, style }: AddPageButtonProps) {
|
||||
}, [currentVersion, setChangelogCheckAtom]);
|
||||
const onClickUpdate = useCallback(() => {
|
||||
if (updateReady) {
|
||||
window.apis?.updater.quitAndInstall();
|
||||
window.apis?.updater.quitAndInstall().catch(err => {
|
||||
// TODO: add error toast here
|
||||
console.error(err);
|
||||
});
|
||||
} else if (updateAvailable) {
|
||||
if (updateAvailable.allowAutoUpdate) {
|
||||
// wait for download to finish
|
||||
|
||||
@@ -9,8 +9,15 @@ export const CopyLink = ({ onItemClick, onSelect }: CommonMenuItemProps) => {
|
||||
const t = useAFFiNEI18N();
|
||||
|
||||
const copyUrl = useCallback(() => {
|
||||
navigator.clipboard.writeText(window.location.href);
|
||||
toast(t['Copied link to clipboard']());
|
||||
navigator.clipboard
|
||||
.writeText(window.location.href)
|
||||
.then(() => {
|
||||
toast(t['Copied link to clipboard']());
|
||||
})
|
||||
.catch(err => {
|
||||
// TODO add error toast here
|
||||
console.error(err);
|
||||
});
|
||||
}, [t]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -35,8 +35,13 @@ const ExportToPdfMenuItem = ({
|
||||
if (result !== undefined) {
|
||||
return;
|
||||
}
|
||||
contentParser.exportPdf();
|
||||
return contentParser.exportPdf();
|
||||
})
|
||||
.then(() => {
|
||||
onSelect?.({ type: 'pdf' });
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
}, [currentEditor, onSelect]);
|
||||
if (currentEditor && currentEditor.mode === 'page') {
|
||||
@@ -66,7 +71,9 @@ const ExportToHtmlMenuItem = ({
|
||||
if (!contentParserRef.current) {
|
||||
contentParserRef.current = new ContentParser(currentEditor.page);
|
||||
}
|
||||
contentParserRef.current.exportHtml();
|
||||
contentParserRef.current.exportHtml().catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
onSelect?.({ type: 'html' });
|
||||
}, [onSelect, currentEditor]);
|
||||
return (
|
||||
@@ -123,7 +130,9 @@ const ExportToMarkdownMenuItem = ({
|
||||
if (!contentParserRef.current) {
|
||||
contentParserRef.current = new ContentParser(currentEditor.page);
|
||||
}
|
||||
contentParserRef.current.exportMarkdown();
|
||||
contentParserRef.current.exportMarkdown().catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
onSelect?.({ type: 'markdown' });
|
||||
}, [onSelect, currentEditor]);
|
||||
return (
|
||||
|
||||
@@ -10,7 +10,11 @@ const DesktopThemeSync = memo(function DesktopThemeSync() {
|
||||
const onceRef = useRef(false);
|
||||
if (lastThemeRef.current !== theme || !onceRef.current) {
|
||||
if (environment.isDesktop && theme) {
|
||||
window.apis?.ui.handleThemeChange(theme as 'dark' | 'light' | 'system');
|
||||
window.apis?.ui
|
||||
.handleThemeChange(theme as 'dark' | 'light' | 'system')
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
lastThemeRef.current = theme;
|
||||
onceRef.current = true;
|
||||
|
||||
Reference in New Issue
Block a user