Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions airflow-core/src/airflow/ui/src/pages/XCom/XComModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const XComModal = ({ dagId, isOpen, mapIndex, mode, onClose, runId, taskId, xcom
dagRunId: runId,
deserialize: true,
mapIndex,
stringify: false,
taskId,
xcomKey: xcomKey ?? "",
},
Expand All @@ -67,12 +68,12 @@ const XComModal = ({ dagId, isOpen, mapIndex, mode, onClose, runId, taskId, xcom

// Populate form when editing
useEffect(() => {
if (isEditMode && data?.value !== undefined) {
if (isOpen && isEditMode && data) {
const val = data.value;

setValue(typeof val === "string" ? val : JSON.stringify(val, undefined, 2));
}
}, [data, isEditMode]);
}, [data, isEditMode, isOpen]);

// Reset form when modal closes
useEffect(() => {
Expand Down Expand Up @@ -113,13 +114,25 @@ const XComModal = ({ dagId, isOpen, mapIndex, mode, onClose, runId, taskId, xcom
type: "error",
});
},
onSuccess: async () => {
onSuccess: async (response) => {
queryClient.setQueryData(
[
useXcomServiceGetXcomEntryKey,
{
dagId,
dagRunId: runId,
deserialize: true,
mapIndex,
stringify: false,
taskId,
xcomKey,
},
],
response,
);
Comment on lines +117 to +132
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we changing this? Doesn't seem related.

await queryClient.invalidateQueries({
queryKey: [useXcomServiceGetXcomEntriesKey],
});
await queryClient.invalidateQueries({
queryKey: [useXcomServiceGetXcomEntryKey],
});
onClose();
toaster.create({
description: translate("browse:xcom.edit.success"),
Expand Down
Loading