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

Upgraded from @agm and am having trouble the snazzy input window #167

Open
ptsoccer opened this issue Sep 11, 2023 · 4 comments
Open

Upgraded from @agm and am having trouble the snazzy input window #167

ptsoccer opened this issue Sep 11, 2023 · 4 comments

Comments

@ptsoccer
Copy link

When showing the snazzy info window, I get error "Error: Uncaught (in promise): TypeError: this.setMap is not a function". Doing some research led to this github issue in the underlying library: atmist/snazzy-info-window#29. It seems that the snazzy-info-window library is being loaded before the google maps js library, and so this derived class ends up with a blank parent prototype effectively.

The comments in the linked issue seem to suggest forcing the snazzy library to open later, and that seems like the obvious solution, but I have no idea how to do command angular to do that. It seems like webpack is loading the library before any angular code runs at all, so I have no way to configure behavior it seems like.

This part of the JS ecosystem I am barely familiar with, so I don't really know where to begin to fix this, so I'm hoping someone might have an idea of what to do here. As a disclaimer, I upgraded from angular 15 to angular 16 and switch from @agm to ng-maps at the same time since it seems agm no longer compiles in 16. It certainly is possible the 15 to 16 change could also be causing issues, but I was hoping someone more experienced in the area could comment on the issue before try the conversion at 15.

@DaSchTour
Copy link
Contributor

There is also issue #76 regarding snazzy info window. I already tried to make it work but the library doesn't behave as expected when lazy loaded. I'm also not sure how to progress on this front.

@ptsoccer
Copy link
Author

FWIW, it seems like the sample app has the same issue

@DaSchTour
Copy link
Contributor

Yes I know. That's where I was trying to make it work, but with no luck.

@ptsoccer
Copy link
Author

I have even worse news. I managed to get stuff to load correctly by making a copy of the JS snazzy-info-window and configuring angular/typescript to look at that, but while it got rid of the getMap/setMap errors, there are still more errors. Much of the google api is async now, and one of the things that the snazzy component does is query a marker manager for the google maps native marker. The ng-maps marker component itself adds the native marker to the manager, but the issue is there is some async stuff involved so the snazzy component ends up querying the manager for the native marker before the marker component adds it, thus causing no errors but the window won't work anyway.

I can try to summarize the changes I made to get to this point if you want, but I think I'm kind of done trying to make it work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants