Skip to content

Commit bfde81c

Browse files
committed
尝试修复浏览器Uncaught DOMException: The operation was aborted. 报错
1 parent 3001ba9 commit bfde81c

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

src/routes/__root.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import "@/style.css";
2-
import { createRootRoute, HeadContent, Outlet } from "@tanstack/react-router";
3-
import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
1+
import "@/style.css"
2+
import { createRootRoute, HeadContent, Outlet } from "@tanstack/react-router"
3+
import { TanStackRouterDevtools } from "@tanstack/react-router-devtools"
44

55
export const Route = createRootRoute({
66
component: Component,
77
head: () => ({
88
meta: [{ title: "星链" }]
99
})
10-
});
10+
})
1111
function Component() {
1212
return <>
1313
<HeadContent />
1414
<Outlet />
1515
<TanStackRouterDevtools />
16-
</>;
16+
</>
1717
}

src/routes/viewport.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ import Dexie, { type EntityTable } from "dexie"
1414
import { ExternalLink, Info, Maximize, Minimize, Minimize2, X } from "lucide-react"
1515
import React, { useEffect, useMemo, useState } from "react"
1616
import { createStore } from "zustand"
17-
import { combine } from "zustand/middleware";
18-
import { Octokit } from "octokit";
17+
import { combine } from "zustand/middleware"
18+
import { Octokit } from "octokit"
1919
import { open_url } from "@/lib/opener"
2020
import type { UserInfo } from "@/lib/type"
21+
import { init as wasm_init } from "wasm-and-native"
2122

2223
const Store = createStore(combine({
2324
wasm_inited: false,
@@ -38,7 +39,7 @@ export const Route = createFileRoute("/viewport")({
3839
beforeLoad: async () => {
3940
const store = Store.getState()
4041
if (!store.get().wasm_inited) {
41-
(await import("wasm-and-native")).init()
42+
wasm_init()
4243
store.set({ wasm_inited: true })
4344
}
4445
if (!store.get().dexie) {
@@ -60,7 +61,7 @@ export const Route = createFileRoute("/viewport")({
6061
function Component() {
6162
const context = Route.useRouteContext()
6263
const is_tauri = useMemo(isTauri, [])
63-
const navigate = useNavigate();
64+
const navigate = useNavigate()
6465
const [is_maximized, set_is_maximized] = useState(false)
6566
const [about_dialog_opened, set_about_dialog_opened] = useState(false)
6667
const [clear_all_data_alert_dialog_opened, set_clear_all_data_alert_dialog_opened] = useState(false)
@@ -70,7 +71,7 @@ function Component() {
7071
avatar_url: string
7172
bio: string | null
7273
html_url: string
73-
}[]>();
74+
}[]>()
7475
useEffect(() => { navigate({ to: "/viewport/login" }) }, [])
7576
useEffect(() => {
7677
if (!is_tauri) return

src/routes/viewport/login.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function Component() {
113113
value={field.value}
114114
onValueChange={(value) => {
115115
field.onChange(value)
116-
login_form.setValue("avatar_url", users?.find((a) => a.id === value)?.avatar_url);
116+
login_form.setValue("avatar_url", users?.find((a) => a.id === value)?.avatar_url)
117117
}}
118118
>
119119
<FormControl>

src/routes/viewport/main.$user_id.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const Route = createFileRoute("/viewport/main/$user_id")({
9595
function Component() {
9696
const context = Route.useRouteContext()
9797
const params = Route.useParams()
98-
const [search_user_result, set_search_user_result] = useState<Omit<UserInfo, "avatar"> & { avatar_url?: string }>();
98+
const [search_user_result, set_search_user_result] = useState<Omit<UserInfo, "avatar"> & { avatar_url?: string }>()
9999
//好友
100100
const friends = useLiveQuery(async () => {
101101
const friends: (Omit<UserInfo, "avatar"> & { id: string, avatar_url?: string })[] = []

0 commit comments

Comments
 (0)