MCPcopy Create free account
hub / github.com/Qinbf/groundmap / onChange

Function onChange

web/components/WorkspaceSwitcher.tsx:35–46  ·  view source on GitHub ↗
(ws: string)

Source from the content-addressed store, hash-verified

33 if (workspaces.length <= 1) return null;
34
35 const onChange = (ws: string) => {
36 if (!ws || ws === current) return;
37 document.cookie = `${WORKSPACE_COOKIE}=${ws}; path=/; max-age=${60 * 60 * 24 * 365}; SameSite=Lax`;
38 // 页面级路由(/page/、/blocks/)的具体页在新 workspace 里多半不存在 → 回首页避免 404;
39 // 其余路由(/health、/graph 等 按当前 workspace 渲染)原地刷新即可。
40 const p = window.location.pathname;
41 if (p.startsWith("/page/") || p.startsWith("/blocks/")) {
42 window.location.assign("/");
43 } else {
44 window.location.reload();
45 }
46 };
47
48 return (
49 <select

Callers 6

ModePickerFunction · 0.85
ProviderPickerFunction · 0.85
WorkspaceSwitcherFunction · 0.85
setFunction · 0.85
SelectFunction · 0.85
DateInputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected