Oops, fix loading state bug on homepage!

Right, when there are zero layers, we shouldn't say we're loading!

This is a consequence of the HACK below. If we didn't short-circuit the effect when length == 0, then we would go through and successfully load 0 layers.
This commit is contained in:
Emi Matchu 2021-06-20 12:04:07 -07:00
parent 6652e66af1
commit e2aeb90b4b

View file

@ -359,7 +359,7 @@ export function usePreloadLayers(layers) {
// NOTE: This condition would need to change if we started loading one at a
// time, or if the error case would need to show a partial state!
const loading = loadedLayers !== layers;
const loading = layers.length > 0 && loadedLayers !== layers;
React.useEffect(() => {
// HACK: Don't clear the preview when we have zero layers, because it