Skip to content
This repository was archived by the owner on Oct 21, 2026. It is now read-only.
Merged
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
11 changes: 9 additions & 2 deletions apps/web/src/components/automations/AutomationsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,14 @@ function AutomationEditor({
}) {
const navigate = useNavigate();
const [draft, setDraft] = useState(initial);
// The saved version the draft started from. When another client changes the automation,
// adopt it unless this editor has unsaved edits of its own.
const [base, setBase] = useState(initial);
const saved = existing ? draftFromAutomation(existing) : null;
if (saved && JSON.stringify(saved) !== JSON.stringify(base)) {
setBase(saved);
if (JSON.stringify(draft) === JSON.stringify(base)) setDraft(saved);
}
const [saving, setSaving] = useState(false);
const [running, setRunning] = useState(false);
const create = useAtomCommand(createAutomation);
Expand All @@ -525,8 +533,7 @@ function AutomationEditor({
setDraft((current) => ({ ...current, ...next }));
const result = configFromDraft({ ...draft, environmentId });
const moving = existing !== null && environmentId !== existing.environmentId;
const dirty =
existing === null || JSON.stringify(draft) !== JSON.stringify(draftFromAutomation(existing));
const dirty = saved === null || JSON.stringify(draft) !== JSON.stringify(saved);

const save = async () => {
if ("error" in result) return;
Expand Down
Loading