seProps circular definition

Hi, I’m running into a circular definition RuntimeError when I try to do the following in I’m trying to defind a new DeckGL instance and have a onViewStateChange function update a property of this instance

deckgl = {

  var zoomMode = 'X'
  return new deck.DeckGL({
    views: new deck.OrthographicView(),
    controller: {scrollZoom: true, inertia: true, zoomAxis: 'X'},
    initialViewState: {target: [0, 0, 0], zoom: [0, 0]},

    // circular definition
    onViewStateChange: ({viewState}) => {
      const nextZoomMode = viewState.zoom[0] > 3 ? 'all' : 'X'
      if (zoomMode !== nextZoomMode) {

        // update zoom mode
        zoomMode = nextZoomMode


        // update Props
          controller: {zoomAxis: zoomMode}

Here is a link to the notebook with the error and a Github page describing more background on the notebook.

Any help would be greatly appreciated :slight_smile:

Access the instance by assigning it to a local variable:

const instance = new deck.DeckGL({
// ...

or via the context (presumably, didn’t verify it’s the right context):

1 Like

Thanks @mootari !! The first approach worked see - Tutorial: Custom Primitive Layer - 2D Zoom Test, fix circular / Nicolas Fernandez | Observable