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(google-maps): ensure that a mapTypeId is always passed in #22098

Merged
merged 1 commit into from
Mar 23, 2021

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Mar 3, 2021

We pass in mapTypeId as undefined if the provided options don't have it. This seems to trigger a bug in Google Maps where it stops loading map tiles.

These changes fix the issue by always providing a mapTypeId.

Fixes #22082.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Mar 3, 2021
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Mar 3, 2021
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added the action: merge The PR is ready for merge by the caretaker label Mar 11, 2021
@@ -35,7 +35,8 @@ interface GoogleMapsWindow extends Window {
/** default options set to the Googleplex */
export const DEFAULT_OPTIONS: google.maps.MapOptions = {
center: {lat: 37.421995, lng: -122.084092},
zoom: 17
zoom: 17,
mapTypeId: 'roadmap'
Copy link
Contributor

Choose a reason for hiding this comment

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

Getting this error internally:

TS2322: Type 'string' is not assignable to type 'MapTypeId | undefined'.

Could we instead do 'roadmap' as MapTypeId to resolve that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, although it's weird that our CI didn't catch it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeesh now I'm getting this

TS2352: Conversion of type 'string' to type 'MapTypeId' may be a mistake because
neither type sufficiently overlaps with the other. If this was intentional, convert the 
expression to 'unknown' first.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

We pass in `mapTypeId` as undefined if the provided options don't have it. This seems to
trigger a bug in Google Maps where it stops loading map tiles.

These changes fix the issue by always providing a `mapTypeId`.

Fixes angular#22082.
@andrewseguin andrewseguin merged commit 7c9b83a into angular:master Mar 23, 2021
andrewseguin pushed a commit that referenced this pull request Mar 23, 2021
We pass in `mapTypeId` as undefined if the provided options don't have it. This seems to
trigger a bug in Google Maps where it stops loading map tiles.

These changes fix the issue by always providing a `mapTypeId`.

Fixes #22082.

(cherry picked from commit 7c9b83a)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(google-maps): Map won't load after assigning new options
4 participants