Select to view content in your preferred language

cancelled:layerview-create error in view.whenLayerView()

101
0
a week ago
Ma1h
by
New Contributor

I have the following code to create and load a GraphicsLayerView. When the user navigates away from the tab while the map is rendering, which triggers ngOnDestroy() to destroy the mapView, it receives the cancelled:layerview-create error. Can this error be safely ignored or there's a better way to handle it? Thanks.

 

const func = () {
    const subject$ = new Subject<void>();
    this.layer = this.service.createGraphicsLayer().layer;
    this.service.loadGraphicsLayer(this.map, this.layer).subscribe(() => {
      this.mapView.whenLayerView(this.layer).then((lv: __esri.GraphicsLayerView) => {
        this.layerView = lv;
        subject$.next(void 0);
        subject$.complete();
      })
      // .catch(error => {
      //   if (error.name !== 'cancelled:layerview-create') {
      //     throw error;
      //   }
      // });
    });
    return subject$;
}

 

 

Logging exception stacktrace for full details:

  1. _s {name: 'cancelled:layerview-create', details: {…}, message: 'layerview creation cancelled'}
    1. details: {layer: p7}
    2. message: "layerview creation cancelled"
    3. name: "cancelled:layerview-create"
    4.  [[Prototype]]: e4
0 Kudos
0 Replies