Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
oyamauchi committed Sep 18, 2023
1 parent 731e705 commit 00a59a5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/state-calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ export class RewiringAmericaStateCalculator extends LitElement {
this.selectedProject = (formData.get('project') as Project) || '';

// Zip is the only thing that determines what utilities are available, so
// only fetch utilities if zip has changed since last calculation.
const zipChanged = this.zip !== prevZip;
if (zipChanged) {
// only fetch utilities if zip has changed since last calculation, or if
// utilities haven't been fetched yet at all.
if (
this.zip !== prevZip ||
this._utilitiesTask.status !== TaskStatus.COMPLETE
) {
// This will run _task when it's done.
this._utilitiesTask.run();
} else {
Expand Down

0 comments on commit 00a59a5

Please sign in to comment.