fix: disable native context menu and add sidebar refresh button (#159)

Prevent browser native "Reload" from resetting app state in Tauri,
and add a refresh button to the sidebar header for convenience.
This commit is contained in:
t8y2
2026-05-08 19:05:21 +08:00
parent 85be58822e
commit acfe9d1b23
5 changed files with 40 additions and 1 deletions
+17
View File
@@ -800,6 +800,22 @@ export const useConnectionStore = defineStore("connection", () => {
persistSidebarLayoutDebounced();
}
function refreshAllTree() {
const resetChildren = (nodes: TreeNode[]) => {
for (const node of nodes) {
if (node.type === "connection-group") {
if (node.children) resetChildren(node.children);
continue;
}
if (node.isExpanded) {
node.isExpanded = false;
node.children = [];
}
}
};
resetChildren(treeNodes.value);
}
async function exportConnectionsToFile(passphrase: string) {
const { encryptConfig } = await import("@/lib/configCrypto");
const exportData = { connections: connections.value, layout: sidebarLayout.value };
@@ -946,6 +962,7 @@ export const useConnectionStore = defineStore("connection", () => {
connections,
activeConnectionId,
treeNodes,
refreshAllTree,
connectedIds,
connectionErrors,
setConnectionError,