Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: sql rollback preview (#12024)

Liu Jif71d4ba3d1ca
diff --git a/frontend/src/components/IssueV1/components/Sidebar/RollbackSection/RollbackStatus.vue b/frontend/src/components/IssueV1/components/Sidebar/RollbackSection/RollbackStatus.vue
index 8ee959ad2d..ab93687e32 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/RollbackSection/RollbackStatus.vue
+++ b/frontend/src/components/IssueV1/components/Sidebar/RollbackSection/RollbackStatus.vue
@@ -91,15 +91,6 @@ const allowPreviewRollback = computed(() => {
});
const tryRollbackTask = async () => {
- // const navigateToRollbackIssue = () => {
- // if (!state.rollbackIssue) return;
- // router.push(`/issue/${state.rollbackIssue.uid}`);
- // };
-
- // if (state.rollbackIssue) {
- // return navigateToRollbackIssue();
- // }
-
if (!config.value) return;
try {
state.loading = true;
@@ -116,7 +107,9 @@ const tryRollbackTask = async () => {
);
const description = [
"The original SQL statement:",
+ "```",
`${new TextDecoder().decode(originalSheet?.content)}`,
+ "```",
].join("\n");
router.push({
diff --git a/frontend/src/components/IssueV1/logic/initialize/create.ts b/frontend/src/components/IssueV1/logic/initialize/create.ts
index fdd068567b..3fed07e809 100644
--- a/frontend/src/components/IssueV1/logic/initialize/create.ts
+++ b/frontend/src/components/IssueV1/logic/initialize/create.ts
@@ -57,8 +57,10 @@ type CreateIssueParams = {
branch?: string;
};
-export const createIssueSkeleton = async (query: Record<string, string>) => {
- const route = useRoute();
+export const createIssueSkeleton = async (
+ route: ReturnType<typeof useRoute>,
+ query: Record<string, string>
+) => {
const projectName = route.params.projectId as string;
const project = await useProjectV1Store().getOrFetchProjectByName(
`${projectNamePrefix}${projectName}`
diff --git a/frontend/src/components/IssueV1/logic/initialize/index.ts b/frontend/src/components/IssueV1/logic/initialize/index.ts
index 3b1ef4deb5..28725021d6 100644
--- a/frontend/src/components/IssueV1/logic/initialize/index.ts
+++ b/frontend/src/components/IssueV1/logic/initialize/index.ts
@@ -39,6 +39,7 @@ export function useInitializeIssue(
const issue =
uid === String(EMPTY_ID)
? await createIssueSkeleton(
+ route,
convertRouterQuery(router.resolve(url).query)
)
: await experimentalFetchIssueByUID(uid, project);
@@ -73,7 +74,10 @@ export function useInitializeIssue(
const url = route.fullPath;
const query = convertRouterQuery(router.resolve(url).query);
try {
- const updated = await createIssueSkeleton({ ...query, ...overrides });
+ const updated = await createIssueSkeleton(route, {
+ ...query,
+ ...overrides,
+ });
issue.value = updated;
} catch {
// Nothing