question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clusters are breaking the universal app

See original GitHub issue

Issue description

Just importing the cluster module is breaking the app.

Steps to reproduce and a minimal demo of the problem

I have a map where all its markers are under a cluster. The map is wrapped into a conditional so it renders only on client (not on the server) because there are known issues. However, it still breaks the server side rendering because it tries to access window at some point. This probably happens during module initialization, since the component itself never got instantiated.

Current behavior

Apps using cluster cannot be used in a server side app.

Expected/desired behavior

Apps should not break.

angular & angular-google-maps version

  • @angular/* at 5.0.0
  • @agm/core at 1.0.0-beta.2

Other information

I’m looking for a workaround ATM but, of course, would be nice if users having a Universal app do not have to do anything. We should at least wrap all code with isPlatformBrowser and just list that as a caveat for now, until we figure out how to render maps on the server, if it’s even possible.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:30 (4 by maintainers)

github_iconTop GitHub Comments

13reactions
mbrezovskycommented, Jan 4, 2018

I forked js-marker-clusterer project and made the fix. It prevents initialization MarkerClusterer when window is not defined (on server side rendering). So marker clusterer works correctly in both cases now.

It’s published in npm. https://www.npmjs.com/package/js-marker-clusterer-universal

js-marker-clusterer dependency should be replaced by js-marker-clusterer-universal to take effect.

4reactions
cmddavidcommented, Apr 17, 2018

@AoschkA I’m still using the workaround as mentioned in my earlier comment. You can find my example here: https://github.com/cmddavid/js-marker-clusterer.git

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clusters are breaking the universal app · Issue #1241 - GitHub
I have a map where all its markers are under a cluster. The map is wrapped into a conditional so it renders only...
Read more >
NT Clusters | ITPro Today
For enterprises with mission-critical applications, clustered systems are the acid test of OS enterprise-worthiness. Although Windows NT cluster systems ...
Read more >
StringInfo and TextElementEnumerator are now UAX29 ...
StrReverse method, which reverses the characters in a string in Visual Basic, now also follows the Unicode standard for grapheme clusters.
Read more >
Known issues - Splunk Documentation
On Search Head Cluster It is not possible to remove an App from the SHs once it has been disabled. Universal forwarder issues....
Read more >
BREAKING: Universal Orlando Resort Theme Parks Planned ...
Lounge chairs will be placed in clusters to support travel party seating, with each cluster separated 6-feet apart. As we saw throughout ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found