fix(frontend): clear stale execution results before dry-run/no-input runs

Port the clearAllNodeExecutionResults call from #12575 so the UI
shows fresh output instead of stale results from prior executions.
Also fix pre-existing TS errors in admin rate-limit components.
This commit is contained in:
Zamil Majdy
2026-03-29 08:13:23 +02:00
parent 7cd6733ad5
commit 419c3b3141
3 changed files with 13 additions and 8 deletions

View File

@@ -6,7 +6,7 @@ import type { UserRateLimitResponse } from "@/app/api/__generated__/models/userR
import { UsageBar } from "../../components/UsageBar";
interface Props {
data: UserRateLimitResponse;
data: UserRateLimitResponse & { user_email?: string };
onReset: (resetWeekly: boolean) => Promise<void>;
/** Override the outer container classes (default: bordered card). */
className?: string;

View File

@@ -50,16 +50,19 @@ export function useRateLimitManager() {
try {
const params = looksLikeEmail(trimmed)
? { email: trimmed }
? ({ email: trimmed } as unknown as { user_id: string })
: { user_id: trimmed };
const response = await getV2GetUserRateLimit(params);
if (response.status !== 200) {
throw new Error("Failed to fetch rate limit");
}
setRateLimitData(response.data);
const data = response.data as UserRateLimitResponse & {
user_email?: string;
};
setRateLimitData(data);
setSelectedUser({
user_id: response.data.user_id,
user_email: response.data.user_email ?? response.data.user_id,
user_id: data.user_id,
user_email: data.user_email ?? data.user_id,
});
} catch (error) {
console.error("Error fetching rate limit:", error);

View File

@@ -36,6 +36,9 @@ export const useRunGraph = () => {
const cleanNodesStatuses = useNodeStore(
useShallow((state) => state.cleanNodesStatuses),
);
const clearAllNodeExecutionResults = useNodeStore(
useShallow((state) => state.clearAllNodeExecutionResults),
);
// Tutorial integration - force open dialog when tutorial requests it
const forceOpenRunInputDialog = useTutorialStore(
@@ -140,9 +143,8 @@ export const useRunGraph = () => {
if (!dryRun && (hasInputs() || hasCredentials())) {
setOpenRunInputDialog(true);
} else {
// Clear previous node statuses so fresh execution results are visible.
// Without this, stale COMPLETED badges from a previous run remain and
// new RUNNING/COMPLETED updates from the dry-run are not rendered.
// Clear stale results so the UI shows fresh output from this execution
clearAllNodeExecutionResults();
cleanNodesStatuses();
// Optimistically set running state immediately for responsive UI
setIsGraphRunning(true);