Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Fix: Fixed type errors revealed by Cypress. #167

Merged
merged 3 commits into from
Mar 2, 2022

Conversation

James-Nitron
Copy link

Type issues:

Map.svelte:
container needs to be either a string or HTMLElement.

Fix: Wait for the container to be defined before generating the map.

Tileset.svelte:
"Cannot read properties of undefined (reading 'getSource')"

Fix: map.isStyleLoaded(id) was causing the error. A Github discussion suggested using map.on(style.loaded) which is an undocumented Mapbox lifecycle event. Using the above stops these errors from generating and after comparing to https://ons-data-map.netlify.app/ looks as if everything still works as expected and seems like there might be a slight speed increase with styles loading.

ONSAutosuggest.svelte
Uncaught TypeError: Cannot read property 'innerText' of null

Fix: Check input exists before attempting to extract innerText.

@netlify
Copy link

netlify bot commented Mar 1, 2022

✔️ Deploy Preview for ons-data-map ready!

🔨 Explore the source changes: 5221a8a

🔍 Inspect the deploy log: https://app.netlify.com/sites/ons-data-map/deploys/621f4f6b400d420008bb589f

😎 Browse the preview: https://deploy-preview-167--ons-data-map.netlify.app

@designorant
Copy link

Nice one!

Would you mind linking the discussion to that undocumented lifecycle method?

@James-Nitron
Copy link
Author

Nice one!

Would you mind linking the discussion to that undocumented lifecycle method?

Good shout, link is mapbox/mapbox-gl-js#2268

@completer
Copy link

Hmm, using an undocumented API sounds quite a drastic solution.

@completer
Copy link

My thoughts are it points to something else being wrong, but I’m happy for now if it gets marked with a big warning comment and a link to @mourner’s comment. @designorant

Copy link

@designorant designorant left a comment

Choose a reason for hiding this comment

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

🚀

@James-Nitron James-Nitron merged commit 819d4e6 into master Mar 2, 2022
@designorant designorant deleted the fix/invalid-type-347 branch March 2, 2022 16:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants