There are common errors that are (or were) once so common that we've built tools to help us avoid them. So I was a little surprised to see this JavaScript from Annie's co-worker.

toggleField() {
    this.updateToggle(this.obj.id, this.toggle).subscribe(data=> {
      if (data.status = "success") {
        this.showToast('Toggle updated successfully');
		...
	  }
	  ...
	}
}

This code handily ensures that the user will always be told that the toggle updates successfully. Note the "condition"- data.status = "success". It's an assignment, not a condition.

This is a super common mistake, easy to make, which is why Annie's team uses a linter as part of their CI process to ensure they don't slip through. Unfortunately, the developer responsible for this code also changed the CI job settings to ensure that this stopped giving them an error, because obviously making the error go away is more important than fixing it.

Annie fixed the code, but admits: "The user experience was always positive, but it's about to get worse."

[Advertisement] Otter - Provision your servers automatically without ever needing to log-in to a command prompt. Get started today!