streetscape.gl icon indicating copy to clipboard operation
streetscape.gl copied to clipboard

Change of name property in a view mode causes full re-render of Deck view

Open jorisw opened this issue 4 years ago • 0 comments

This took me a long time to debug:

When the LogViewer receives a new viewMode prop, the name of the viewMode is used by some deeply nested code in Streetscape, to determine the id of the map view. This id seems to be the deciding factor in whether the existing map view is retained.

This produces a degraded user experience, as switching viewModes now means that all the tiles on screen are discarded and newly loaded as part of the new view.

Keeping viewModes with the same name property in our constants.js, allows us to have a much smoother user experience when switching between these view modes.

Of course the only way to find this out was to dig through the source code. I think this should be documented or changed.

Relevant parts of code:

https://github.com/uber/streetscape.gl/blob/888405d49a9fcc8606a20246c3b5e85b2a99d79a/modules/core/src/components/log-viewer/core-3d-viewer.js#L387

https://github.com/uber/streetscape.gl/blob/888405d49a9fcc8606a20246c3b5e85b2a99d79a/modules/core/src/utils/viewport.js#L83-L87

jorisw avatar Dec 12 '19 10:12 jorisw