fix: fetch server version in onboarding to unblock wizard mount

This commit is contained in:
haorwen
2026-06-21 18:03:34 +08:00
parent 466345b79d
commit b8ac5fd04a
2 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "vocechat-web", "name": "vocechat-web",
"version": "0.9.85", "version": "0.9.86",
"homepage": "https://voce.chat", "homepage": "https://voce.chat",
"dependencies": { "dependencies": {
"@metamask/onboarding": "^1.0.1", "@metamask/onboarding": "^1.0.1",
+4 -3
View File
@@ -12,7 +12,7 @@ import ServerName from "./steps/server-name";
import WelcomePage from "./steps/welcome-page"; import WelcomePage from "./steps/welcome-page";
import WhoCanSignUp from "./steps/who-can-sign-up"; import WhoCanSignUp from "./steps/who-can-sign-up";
import SelectLanguage from "../../components/Language"; import SelectLanguage from "../../components/Language";
import { useGetAutoTunnelInfoQuery } from "@/app/services/server"; import { useGetAutoTunnelInfoQuery, useGetServerVersionQuery } from "@/app/services/server";
import { useAppSelector } from "@/app/store"; import { useAppSelector } from "@/app/store";
import { compareVersion } from "@/utils"; import { compareVersion } from "@/utils";
import { shallowEqual } from "react-redux"; import { shallowEqual } from "react-redux";
@@ -59,14 +59,15 @@ const Navigator = ({ showTunnelStep }: { showTunnelStep: boolean }) => {
export default function OnboardingPage() { export default function OnboardingPage() {
const { t } = useTranslation("welcome"); const { t } = useTranslation("welcome");
const [serverName, setServerName] = useState(""); const [serverName, setServerName] = useState("");
const { isLoading: versionLoading } = useGetServerVersionQuery();
const currentVersion = useAppSelector((store) => store.server.version, shallowEqual); const currentVersion = useAppSelector((store) => store.server.version, shallowEqual);
const versionOk = !!currentVersion && compareVersion(currentVersion, TUNNEL_MIN_VERSION) >= 0; const versionOk = !!currentVersion && compareVersion(currentVersion, TUNNEL_MIN_VERSION) >= 0;
const { data: autoInfo, isLoading: autoInfoLoading } = useGetAutoTunnelInfoQuery(undefined, { skip: !versionOk }); const { data: autoInfo } = useGetAutoTunnelInfoQuery(undefined, { skip: !versionOk });
const showTunnelStep = versionOk && !!autoInfo && !autoInfo.auto_cftunnel; const showTunnelStep = versionOk && !!autoInfo && !autoInfo.auto_cftunnel;
// Wait until we know whether to show the tunnel step before mounting Wizard // Wait until we know whether to show the tunnel step before mounting Wizard
// so step count is stable from mount // so step count is stable from mount
const ready = currentVersion && (!versionOk || autoInfo !== undefined); const ready = !versionLoading && (!versionOk || autoInfo !== undefined);
if (!ready) return null; if (!ready) return null;
return ( return (