From 15543ed307c5360d84e5b223b29b126c80b50182 Mon Sep 17 00:00:00 2001 From: Brian Pilati Date: Mon, 23 Jun 2025 17:04:21 -0500 Subject: [PATCH 1/2] Added fix to break a race-condition error --- app/preprints/-components/submit/supplements/component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/preprints/-components/submit/supplements/component.ts b/app/preprints/-components/submit/supplements/component.ts index bc59396666..5abec932d7 100644 --- a/app/preprints/-components/submit/supplements/component.ts +++ b/app/preprints/-components/submit/supplements/component.ts @@ -69,6 +69,7 @@ export default class Supplements extends Component{ @waitFor public async removeSelectedProject(): Promise { try { + this.args.manager.validateSupplements(false); await this.args.manager.preprint.removeM2MRelationship('node'); // Remove relationship // Remove relationship on the node side, this only clears the cache locally this.args.manager.preprint.node.get('preprints') From aa96b7eb85f1bd46af11e8606b3d92b78a8fd5f2 Mon Sep 17 00:00:00 2001 From: Brian Pilati Date: Tue, 24 Jun 2025 12:00:51 -0500 Subject: [PATCH 2/2] Refactor to use the abstracted method --- app/preprints/-components/submit/supplements/component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/preprints/-components/submit/supplements/component.ts b/app/preprints/-components/submit/supplements/component.ts index 5abec932d7..6c4dbe337d 100644 --- a/app/preprints/-components/submit/supplements/component.ts +++ b/app/preprints/-components/submit/supplements/component.ts @@ -69,7 +69,7 @@ export default class Supplements extends Component{ @waitFor public async removeSelectedProject(): Promise { try { - this.args.manager.validateSupplements(false); + this.validate(false); await this.args.manager.preprint.removeM2MRelationship('node'); // Remove relationship // Remove relationship on the node side, this only clears the cache locally this.args.manager.preprint.node.get('preprints') @@ -90,7 +90,7 @@ export default class Supplements extends Component{ } @action - public validate(): void { - this.args.manager.validateSupplements(true); + public validate(isValid = true): void { + this.args.manager.validateSupplements(isValid); } }