Skip to content

Commit

Permalink
fix(activities): dont delete records while in flight (adfinis#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabauke authored Apr 5, 2023
1 parent 92a419d commit b9c9316
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/index/activities/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Controller from "@ember/controller";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { tracked } from "@glimmer/tracking";
import { timeout } from "ember-concurrency";

/**
* Controller to edit an activity
Expand Down Expand Up @@ -84,6 +85,13 @@ export default class IndexActivitiesEditController extends Controller {
}

try {
let limiter = 0;
while (limiter++ < 100 && this.model.isSaving) {
// wait for maximum 5 seconds for saving changes
// eslint-disable-next-line no-await-in-loop
await timeout(50);
}

await this.model.destroyRecord();

this.notify.success("Activity was deleted");
Expand Down

0 comments on commit b9c9316

Please sign in to comment.