fix(mysql): prevalidate routine saves and support procedure refresh

This commit is contained in:
Mo-Moore authored and GitHub committed 2026-09-22 13:03:32 +08:00
1 parent 0023c03520
commit 4ac2c5dc40
16 files changed
+173 -20

No files matched your search

+13 -1
View File
@@ -2346,7 +2346,19 @@ export const useConnectionStore = defineStore("connection", () => {
function invalidateMetadataCachesForNode(node: TreeNode, options?: { skipObjectCacheInvalidation?: boolean }) {
if (!node.connectionId) return;
const tableName = node.tableName || (node.type === "table" || node.type === "view" || node.type === "materialized_view" || node.type === "mongo-collection" || node.type === "dynamodb-table" ? node.label : undefined);
const isObjectLeaf =
node.type === "procedure" ||
node.type === "function" ||
node.type === "sequence" ||
node.type === "synonym" ||
node.type === "event" ||
node.type === "job" ||
node.type === "package" ||
node.type === "package-body" ||
node.type === "type" ||
node.type === "type-body" ||
node.type === "trigger";
const tableName = isObjectLeaf ? node.objectName || node.label : node.tableName || (node.type === "table" || node.type === "view" || node.type === "materialized_view" || node.type === "mongo-collection" || node.type === "dynamodb-table" ? node.label : undefined);
const match = {
connectionId: node.connectionId,
database: node.database || undefined,
+21
View File
@@ -2873,6 +2873,26 @@ export const useQueryStore = defineStore("query", () => {
void loadObjectSourceIntoTab(id);
}
/**
* Force-reload an object-source tab from the database (user-triggered refresh).
* Callers should confirm before discarding dirty edits.
*/
function refreshObjectSourceTab(id: string): boolean {
const tab = tabs.value.find((candidate) => candidate.id === id);
if (!tab) return false;
if (tab.sourceLoad && !tab.sourceLoad.error) return true;
const request = tab.sourceLoad?.request ? { ...tab.sourceLoad.request } : tab.objectSource ? { name: tab.objectSource.name, objectType: tab.objectSource.objectType, signature: tab.objectSource.signature } : null;
if (!request) return false;
sourceRevalidateInFlight.delete(id);
tab.sourceLoad = {
startedAt: Date.now(),
initialEditing: tab.sourceLoad?.initialEditing ?? !!tab.objectSource,
request,
};
void loadObjectSourceIntoTab(id);
return true;
}
function clearObjectSourceLoad(tab: QueryTab) {
tab.sourceLoad = undefined;
}
@@ -9006,6 +9026,7 @@ export const useQueryStore = defineStore("query", () => {
openObjectSourceTab,
openObjectSourceTabPending,
retryObjectSourceTab,
refreshObjectSourceTab,
showExecutedQueryResults,
focusGroup,
activateTab,