Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure layer loads when dateBefore set early, then moved back late #2701

Merged
merged 6 commits into from
Mar 21, 2023

Conversation

ajacombs
Copy link
Contributor

When the date before slider was moved to a position earlier than any available imagery (causing the map to be empty), and then moved to a position just after an available imagery layer, the attribution text would update to show the change, but the imagery would not load on the map. On moving the date before slider later again, beyond when a second imagery set was available, that second imagery layer would be displayed.

This was caused by if (!Config.map.visibleLayers) being true for both undefined (its value before the sliders have been moved), and the empty string, its value when the sliders are set to a position where there is no imagery available.

Related to this bug, there seemed to be some 'glitchiness' around when imagery layers are loaded. This may be due to transient race conditions between the debouncing added in scheduleUpdateConfig competing with equivalent debouncing for the attribution rendering. This was added to minimise network requests as previously changing the date sliders requested a new attribution json file. With this refactored out to client side filtering, the debouncing is no longer needed, as the loading of new layers is triggered inside the attribution update functions which are already debounced.

@ajacombs ajacombs requested a review from a team as a code owner February 20, 2023 21:27
@@ -91,7 +91,7 @@ export class Basemaps extends Component<unknown, { isLayerSwitcherEnabled: boole
};

updateVisibleLayers = (newLayers: string): void => {
if (!Config.map.visibleLayers) Config.map.visibleLayers = newLayers;
if (Config.map.visibleLayers == null) Config.map.visibleLayers = newLayers;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think visibleLayers is defined as string and not initialised. Might be better to defined as string|null. Then you can do this check for initialising here.

blacha
blacha previously approved these changes Mar 20, 2023
@blacha blacha added this pull request to the merge queue Mar 20, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Mar 20, 2023
@ajacombs ajacombs added this pull request to the merge queue Mar 21, 2023
@ajacombs ajacombs merged commit 1b34d9a into master Mar 21, 2023
@ajacombs ajacombs deleted the fix/layer-loading branch March 21, 2023 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants