Handle erroring action update differently

This commit is contained in:
Carlos Fernandez 2026-07-18 20:41:04 -04:00
parent 7e5e722c5f
commit e42d5ae4b3
2 changed files with 3 additions and 3 deletions

View file

@ -255,7 +255,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
const submitData = this._prepareSubmitData(event, formData); const submitData = this._prepareSubmitData(event, formData);
const data = foundry.utils.mergeObject(this.action.toObject(), submitData); const data = foundry.utils.mergeObject(this.action.toObject(), submitData);
this.action = await this.action.update(data); this.action = (await this.action.update(data)) ?? this.action;
this.sheetUpdate?.(this.action); this.sheetUpdate?.(this.action);
this.render(); this.render();

View file

@ -237,8 +237,8 @@ export function ActionMixin(Base) {
await this.parent.updateSource({ [path]: updates }, options); await this.parent.updateSource({ [path]: updates }, options);
result = this.parent; result = this.parent;
} else { } else {
// If no changes occur, update returns undefined, but we need to re-retrieve the action anyways result = await this.item.update({ [path]: updates }, options);
result = (await this.item.update({ [path]: updates }, options)) ?? this.item; if (!result) return result;
} }
return this.inCollection return this.inCollection