(ws: string)
| 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 |
no outgoing calls
no test coverage detected