vasturiano / react-globe.gl

React component for Globe Data Visualization using ThreeJS/WebGL
https://vasturiano.github.io/react-globe.gl/example/world-population/
MIT License
898 stars 155 forks source link

Error when switching pages #31

Open MickaelNeves opened 3 years ago

MickaelNeves commented 3 years ago

Describe the bug Getting an error while changing from a page that has the Globe component to a page where it doesn't have. If I remove the hexPolygonsData prop the error is gone

To Reproduce

Expected behavior

Screenshots three-globe-error

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

import HEX_DATA from './data/countries_hex_data.json';

<Globe
      ref={globeEl}
      globeImageUrl="/globe/globe-background.png"
      backgroundColor="rgba(0,0,0,0)"
      labelsData={[selectedCountry]}
      labelTypeFace={customFont}
      labelText={useCallback((point) => point.label, [])}
      labelSize={useCallback(() => 1.6, [])}
      labelColor={useCallback(() => 'white', [])}
      labelDotRadius={useCallback(() => 0.4, [])}
      labelAltitude={useCallback(() => 0.05, [])}
      hexPolygonsData={useCallback(HEX_DATA.features, [])} // <- if I remove this line the error is gone
      hexPolygonResolution={useCallback(() => 3, [])}
      hexPolygonMargin={useCallback(() => 0.62, [])}
      hexPolygonColor={useCallback(() => HEX_COLOR, [])}
      enablePointerInteraction={false}
      showAtmosphere={false}
      width={600}
    />

NextJs: "^10.0.1" React: "16.14.0" react-globe.gl: "^2.12.6"

vasturiano commented 3 years ago

Hi @MickaelNeves, thanks for reaching out.

It's difficult to say what's the issue without more context. Are you able to do a reduced example on https://codesandbox.io/ that reproduces the error?