Skip to content

Commit

Permalink
Merge pull request #170 from landryb/fix/168
Browse files Browse the repository at this point in the history
only call getBatiments if there are buildings on the plot (#168)
  • Loading branch information
landryb authored Aug 22, 2022
2 parents 3cab1ba + 056ea39 commit f45ae66
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions js/extension/components/information/Buildings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ export default function Buildings({
const [loading, setLoading] = useState(false);

useEffect(() => {
setLoading(true);
getBatiments({ parcelle, dnubat: letter }).then((data) => {
setBuildings(data);
setSelected([]);
setLoading(false);
});
if (letter) {
setLoading(true);
getBatiments({ parcelle, dnubat: letter }).then((data) => {
setBuildings(data);
setSelected([]);
setLoading(false);
});
}
}, [letter]);

// Description
Expand Down

0 comments on commit f45ae66

Please sign in to comment.