Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
fix(task-selection): prevent action on init
Browse files Browse the repository at this point in the history
It's possible to pass an action to the component in case a new
customer/project/task is selected. This action should not get
triggered when initially setting up the component with the already
selected data.
  • Loading branch information
derrabauke committed Mar 13, 2024
1 parent bdea886 commit 1222ca4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/components/task-selection/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ export default class TaskSelectionComponent extends Component {
task: null,
};

const options = { preventAction: true };

// the objects are possibily wrapped in a proxy which would
// confuse the upcoming null check
const [customer, project, task] = await Promise.all([
Expand All @@ -106,11 +108,11 @@ export default class TaskSelectionComponent extends Component {
]);

if (task) {
this.onTaskChange(task);
this.onTaskChange(task, options);
} else if (project) {
this.onProjectChange(project);
this.onProjectChange(project, options);
} else if (customer) {
this.onCustomerChange(customer);
this.onCustomerChange(customer, options);
} else {
this.tracking.fetchCustomers.perform();
}
Expand Down

0 comments on commit 1222ca4

Please sign in to comment.