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

[Bug]Using @deck.gl/arcgis@9.0.6: When using the map.remove(layer) method, the page goes blank. #8768

Closed
2 of 7 tasks
gdnwr opened this issue Apr 7, 2024 · 0 comments · Fixed by #8773
Closed
2 of 7 tasks
Labels

Comments

@gdnwr
Copy link

gdnwr commented Apr 7, 2024

Description

Using @deck.gl/arcgis@9.0.6: When using the map.remove(layer) method, the page goes blank.
1
2

Flavors

  • Script tag
  • React
  • Python/Jupyter notebook
  • MapboxOverlay
  • GoogleMapsOverlay
  • CartoLayer
  • ArcGIS

Expected Behavior

No response

Steps to Reproduce

https://codesandbox.io/p/sandbox/arcgis-deck-forked-9v3tmh?file=%2Findex.html%3A73%2C17

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="initial-scale=1,maximum-scale=1,user-scalable=no"
    />
    <title>
      Build a custom layer view using deck.gl | Sample | ArcGIS Maps SDK for
      JavaScript 4.29
    </title>

    <script src="https://unpkg.com/deck.gl@9.0.6/dist.min.js"></script>
    <script src="https://unpkg.com/@deck.gl/geo-layers@9.0.6/dist.min.js"></script>
    <script src="https://unpkg.com/@deck.gl/arcgis@9.0.6/dist.min.js"></script>
    <link
      rel="stylesheet"
      href="https://js.arcgis.com/4.29/esri/themes/light/main.css"
    />
    <script src="https://js.arcgis.com/4.29/"></script>

    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
      #removeLayerBtn {
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 50;
      }
    </style>

    <script>
      require(["esri/Map", "esri/views/MapView"], (Map, MapView) => {
        deck.loadArcGISModules().then((arcGIS) => {
          const layer = new arcGIS.DeckLayer();

          layer.deck.layers = [
            new deck.TripsLayer({
              id: "trips",
              data: "https://raw.githubusercontent.com/uber-common/deck.gl-data/master/examples/trips/trips-v7.json",
              getPath: (d) => {
                return d.path;
              },
              getTimestamps: (d) => {
                return d.timestamps;
              },
              getColor: (d) => {
                return d.vendor === 0 ? [253, 128, 93] : [23, 184, 190];
              },
              opacity: 1.0,
              widthMinPixels: 4,
              rounded: true,
              trailLength: 180,
              currentTime: (performance.now() % 20000) / 10,
              shadowEnabled: false,
            }),
          ];

          const map = new Map({
            basemap: "dark-gray-vector",
            layers: [layer],
          });

          const mapView = new MapView({
            container: "viewDiv",
            map,
            center: [-74, 40.72],
            zoom: 14,
          });

          // Remove the layer from the map
          document.getElementById("removeLayerBtn").onclick = () => {
            map.remove(layer);
          };
        });
      });
    </script>
  </head>

  <body>
    <div id="viewDiv">
      <button id="removeLayerBtn">Remove Layer</button>
    </div>
  </body>
</html>

Environment

  • Framework version:deck.gl@9.0.6
  • Browser:Chrome 123.0.6312.58
  • OS:Windows11

Logs

No response

@gdnwr gdnwr added the bug label Apr 7, 2024
@gdnwr gdnwr changed the title [Bug]Using @deck.gl/arcgis@9.0.5: When using the map.remove(layer) method, the page goes blank. [Bug]Using @deck.gl/arcgis@9.0.6: When using the map.remove(layer) method, the page goes blank. Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant