mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
fix(console): reject edits of stale routes
A conflict reload can leave an older route editor open. Compare its original value before saving so it cannot overwrite the newly loaded route.
This commit is contained in:
1 parent
6eb9cbab4e
commit
4fae01453c
2 files changed
+10
No files matched your search
@@ -968,6 +968,13 @@ async function onSave(route: Route): Promise<void> {
|
||||
try {
|
||||
let next: Route[];
|
||||
if (editing.value) {
|
||||
// The route must still be the one the editor opened: a version changed
|
||||
// by someone else meanwhile would otherwise be overwritten silently.
|
||||
const latest = groupRoutes.value.find((r) => r.id === editing.value!.id);
|
||||
if (!latest || JSON.stringify(latest) !== JSON.stringify(editing.value)) {
|
||||
push(t("toast.routeChanged"), "bad");
|
||||
return;
|
||||
}
|
||||
next = groupRoutes.value.map((r) => (r.id === editing.value!.id ? route : r));
|
||||
} else {
|
||||
if (groupRoutes.value.some((r) => r.id === route.id)) {
|
||||
|
||||
Reference in new issue
Block a user