diff --git a/src/renderer/src/configs.ts b/src/renderer/src/configs.ts
index 8c11b0524..dc59298b4 100644
--- a/src/renderer/src/configs.ts
+++ b/src/renderer/src/configs.ts
@@ -24,7 +24,10 @@ export const SentryConfig: BrowserOptions = {
/adsbygoogle/i.test(error.message) ||
/Failed to fetch/i.test(error.message) ||
error.message.includes("fetch failed") ||
- error.message.includes("Unable to open cursor"))
+ error.message.includes("Unable to open cursor") ||
+ error.message.includes(
+ "Document is not focused.",
+ ))
) {
return null
}
@@ -37,8 +40,9 @@ export const SentryConfig: BrowserOptions = {
return false
},
)
+ const isAbortError = error instanceof Error && error.name === "AbortError"
- if (isPassthroughError) {
+ if (isPassthroughError || isAbortError) {
return null
}
return event
diff --git a/src/renderer/src/hooks/biz/useEntryActions.tsx b/src/renderer/src/hooks/biz/useEntryActions.tsx
index 9943e6bbf..c838ba809 100644
--- a/src/renderer/src/hooks/biz/useEntryActions.tsx
+++ b/src/renderer/src/hooks/biz/useEntryActions.tsx
@@ -6,7 +6,11 @@ import {
} from "@renderer/atoms/readability"
import { useIntegrationSettingKey } from "@renderer/atoms/settings/integration"
import { whoami } from "@renderer/atoms/user"
-import { SimpleIconsEagle, SimpleIconsInstapaper, SimpleIconsReadwise } from "@renderer/components/ui/platform-icon/icons"
+import {
+ SimpleIconsEagle,
+ SimpleIconsInstapaper,
+ SimpleIconsReadwise,
+} from "@renderer/components/ui/platform-icon/icons"
import { COPY_MAP } from "@renderer/constants"
import { shortcuts } from "@renderer/constants/shortcuts"
import { tipcClient } from "@renderer/lib/client"
@@ -39,9 +43,15 @@ export const useEntryReadabilityToggle = ({
setReadabilityStatus({
[id]: ReadabilityStatus.WAITING,
})
- const result = await tipcClient?.readability({
- url,
- })
+ const result = await tipcClient
+ ?.readability({
+ url,
+ })
+ .catch(() => {
+ setReadabilityStatus({
+ [id]: ReadabilityStatus.FAILURE,
+ })
+ })
if (result) {
const status = getReadabilityStatus()[id]
@@ -162,7 +172,8 @@ export const useEntryActions = ({
icon: ,
key: "saveToEagle",
hide:
- !enableEagle || (checkEagle.isLoading ? true : !checkEagle.data) ||
+ !enableEagle ||
+ (checkEagle.isLoading ? true : !checkEagle.data) ||
!populatedEntry.entries.media?.length,
onClick: async () => {
if (
@@ -209,9 +220,18 @@ export const useEntryActions = ({
saved_using: "Follow",
},
})
- toast.success(<>Saved to Readwise, view>, {
- duration: 3000,
- })
+ toast.success(
+ <>
+ Saved to Readwise,
+ {" "}
+
+ view
+
+ >,
+ {
+ duration: 3000,
+ },
+ )
} catch {
toast.error("Failed to save to Readwise.", {
duration: 3000,
@@ -223,7 +243,11 @@ export const useEntryActions = ({
name: "Save to Instapaper",
icon: ,
key: "saveToInstapaper",
- hide: !enableInstapaper || !instapaperPassword || !instapaperUsername || !populatedEntry.entries.url,
+ hide:
+ !enableInstapaper ||
+ !instapaperPassword ||
+ !instapaperUsername ||
+ !populatedEntry.entries.url,
onClick: async () => {
try {
const data = await ofetch("https://www.instapaper.com/api/add", {
@@ -233,13 +257,28 @@ export const useEntryActions = ({
},
method: "POST",
headers: {
- Authorization: `Basic ${btoa(`${instapaperUsername}:${instapaperPassword}`)}`,
+ Authorization: `Basic ${btoa(
+ `${instapaperUsername}:${instapaperPassword}`,
+ )}`,
},
parseResponse: JSON.parse,
})
- toast.success(<>Saved to Instapaper, view>, {
- duration: 3000,
- })
+ toast.success(
+ <>
+ Saved to Instapaper,
+ {" "}
+
+ view
+
+ >,
+ {
+ duration: 3000,
+ },
+ )
} catch {
toast.error("Failed to save to Instapaper.", {
duration: 3000,
diff --git a/src/renderer/src/hooks/common/factory/createHTMLMediaHook.ts b/src/renderer/src/hooks/common/factory/createHTMLMediaHook.ts
index 740f4bfd9..ee78377f1 100644
--- a/src/renderer/src/hooks/common/factory/createHTMLMediaHook.ts
+++ b/src/renderer/src/hooks/common/factory/createHTMLMediaHook.ts
@@ -1,6 +1,7 @@
/**
* @see https://github.com/streamich/react-use/blob/master/src/factory/createHTMLMediaHook.ts
*/
+import { noop } from "foxact/noop"
import * as React from "react"
import { useEffect, useRef } from "react"
import { useEventCallback } from "usehooks-ts"
@@ -183,7 +184,7 @@ export default function createHTMLMediaHook<
}
if (!lockPlay) {
- const promise = el.play()
+ const promise = el.play().catch(noop)
const isPromise = typeof promise === "object"
if (isPromise) {