-
-
Notifications
You must be signed in to change notification settings - Fork 401
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 network issue #944
base: main
Are you sure you want to change the base?
Fix network issue #944
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, confirmed this fixes the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
one side question - can't we use a much more readable await syntax?
try {
let response = await fetch(url, {
mode: 'cors',
credentials: "same-origin"
});
if (!response.ok) {
throw new Error('Failed to load metadata for ' + url);
}
cb(await response.json())
}
catch (ex) {
console.warn('Can not load metadata for ' + url + ', using default value ' + defaultValue);
cb(defaultValue)
}
We could, I didn't want to change the code a lot ,and only wanted to solve this issue. It can be done as part of a different PR... |
In general, this callback hell should be removed, much like we did for maplibre, but it's not a small change... |
Launch Checklist
In case of non 200 response the font and glyphs metadata would return the ajax error object instead of the default value.
Fixes #935
Crash - TypeError: i.map is not a function #935
Briefly describe the changes in this PR.
Link to related issues.
Include before/after visuals or gifs if this PR includes visual changes.
Write tests for all new functionality.
Add an entry to
CHANGELOG.md
under the## main
section.