Skip to content

Commit

Permalink
fix: get currentEnvironment.name using the get function
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Jul 28, 2020
1 parent e1846fb commit 7e9083a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ const HeadlessCmsApiUrls = function({ name = null, type = null }) {
} else if (type === "environment") {
return get(elem, "environment.name") === name;
} else {
return get(elem, "environment.name") === currentEnvironment.name;
// Rarely (but still annoying), "currentEnvironment" would be undefined,
// that's why we are fetching the currentEnvironment via `lodash.get` here.
return get(elem, "environment.name") === get(currentEnvironment, "name");
}
})
.map(elem => {
Expand Down

0 comments on commit 7e9083a

Please sign in to comment.