build: web component build error (#858)

* build: build error

* docs: update notes
This commit is contained in:
BiggerRain
2025-08-02 11:14:56 +08:00
committed by GitHub
parent 3ed84c2318
commit d0fc79238b
8 changed files with 56 additions and 46 deletions

View File

@@ -33,6 +33,7 @@ Information about release notes of Coco App is provided here.
- chore: ignore tauri::AppHandle's generic argument R #845
- refactor: check Extension/plugin.json from all sources #846
- refactor: pinning window won't set CanJoinAllSpaces on macOS #854
- build: web component build error #858
## 0.7.1 (2025-07-27)

View File

@@ -16,49 +16,10 @@ import {
} from "@/types/commands";
import { useAppStore } from "@/stores/appStore";
import { useAuthStore } from "@/stores/authStore";
import { useConnectStore } from "@/stores/connectStore";
import { SETTINGS_WINDOW_LABEL } from "@/constants";
import platformAdapter from "@/utils/platformAdapter";
export async function getCurrentWindowService() {
const currentService = useConnectStore.getState().currentService;
const cloudSelectService = useConnectStore.getState().cloudSelectService;
const windowLabel = await platformAdapter.getCurrentWindowLabel();
return windowLabel === SETTINGS_WINDOW_LABEL
? cloudSelectService
: currentService;
}
export async function setCurrentWindowService(service: any) {
const windowLabel = await platformAdapter.getCurrentWindowLabel();
const { setCurrentService, setCloudSelectService } =
useConnectStore.getState();
return windowLabel === SETTINGS_WINDOW_LABEL
? setCloudSelectService(service)
: setCurrentService(service);
}
export async function handleLogout(serverId?: string) {
const setIsCurrentLogin = useAuthStore.getState().setIsCurrentLogin;
const { serverList, setServerList } = useConnectStore.getState();
const service = await getCurrentWindowService();
const id = serverId || service?.id;
if (!id) return;
// Update the status first
setIsCurrentLogin(false);
if (service?.id === id) {
await setCurrentWindowService({ ...service, profile: null });
}
const updatedServerList = serverList.map((server) =>
server.id === id ? { ...server, profile: null } : server
);
setServerList(updatedServerList);
}
import {
getCurrentWindowService,
handleLogout,
} from "@/commands/windowService";
// Endpoints that don't require authentication
const WHITELIST_SERVERS = [

View File

@@ -0,0 +1,44 @@
import { useConnectStore } from "@/stores/connectStore";
import { SETTINGS_WINDOW_LABEL } from "@/constants";
import platformAdapter from "@/utils/platformAdapter";
import { useAuthStore } from "@/stores/authStore";
export async function getCurrentWindowService() {
const currentService = useConnectStore.getState().currentService;
const cloudSelectService = useConnectStore.getState().cloudSelectService;
const windowLabel = await platformAdapter.getCurrentWindowLabel();
return windowLabel === SETTINGS_WINDOW_LABEL
? cloudSelectService
: currentService;
}
export async function setCurrentWindowService(service: any) {
const windowLabel = await platformAdapter.getCurrentWindowLabel();
const { setCurrentService, setCloudSelectService } =
useConnectStore.getState();
return windowLabel === SETTINGS_WINDOW_LABEL
? setCloudSelectService(service)
: setCurrentService(service);
}
export async function handleLogout(serverId?: string) {
const setIsCurrentLogin = useAuthStore.getState().setIsCurrentLogin;
const { serverList, setServerList } = useConnectStore.getState();
const service = await getCurrentWindowService();
const id = serverId || service?.id;
if (!id) return;
// Update the status first
setIsCurrentLogin(false);
if (service?.id === id) {
await setCurrentWindowService({ ...service, profile: null });
}
const updatedServerList = serverList.map((server) =>
server.id === id ? { ...server, profile: null } : server
);
setServerList(updatedServerList);
}

View File

@@ -18,7 +18,7 @@ import StatusIndicator from "@/components/Cloud/StatusIndicator";
import { useAuthStore } from "@/stores/authStore";
import { useSearchStore } from "@/stores/searchStore";
import { useServers } from "@/hooks/useServers";
import { getCurrentWindowService, setCurrentWindowService } from "@/commands";
import { getCurrentWindowService, setCurrentWindowService } from "@/commands/windowService";
interface ServerListProps {
clearChat: () => void;

View File

@@ -7,7 +7,7 @@ import {
getCurrentWindowService,
setCurrentWindowService,
handleLogout,
} from "@/commands/servers";
} from "@/commands/windowService";
export const useServers = () => {
const setServerList = useConnectStore((state) => state.setServerList);

View File

@@ -69,6 +69,7 @@ export interface WindowOperations {
event: string,
callback: (event: any) => void
) => Promise<() => void>;
getCurrentWindowLabel: () => Promise<string>;
}
// Theme and event related interface

View File

@@ -23,7 +23,6 @@ export interface TauriPlatformAdapter extends BasePlatformAdapter {
) => Promise<string | string[] | null>;
metadata: typeof metadata;
error: typeof error;
getCurrentWindowLabel: () => Promise<string>;
}
// Create Tauri adapter functions

View File

@@ -269,5 +269,9 @@ export const createWebAdapter = (): WebPlatformAdapter => {
return res;
},
async getCurrentWindowLabel() {
return "web";
},
};
};