question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Map flickers on transition when viewState is stored in Redux

See original GitHub issue

Description

My problem: https://imgur.com/a/haBPnKB

When putting my viewState in Redux - and starting any kind of transition, I get a clear flicker, where the map will start moving, then return back to its starting position, before continuing the movement. I sometimes also get a warning like the one below when this happens:

[Violation] 'requestAnimationFrame' handler took 103ms

If this is some kind of a race condition, it is a very consistent one. The violation for requestAnimationFrame only happens sometimes.

Neither of these problems exist when I store the viewState in a “useState”-hook instead of Redux.

Repro Steps

CodeSandbox: https://codesandbox.io/s/inspiring-cohen-li1zy

  • Click the map, and hold the + key for some intense flickering.

Environment (please complete the following information):

  • Framework Version: [deck.gl 8.1.3]
  • Browser Version: [ Chrome 80.0.3987.149 (Official Build) (64-bit), Chrome 80.0.3987.163 (Official Build) (64-bit) ]
  • OS: [Manjaro Linux, Windows 10]

Logs

Whenever the onViewStateChange-event fires, I log out the current viewState, and the next one like this:

<DeckGL
  layers={[]}
  viewState={viewState}
  controller={MapController}
  onViewStateChange={e => {
    console.table([viewState, e.viewState])
    setViewState(e.viewState)
  }}
>
  <StaticMap reuseMaps mapStyle={mapStyle} />
</DeckGL>
useState (everything works as expected)

image

Redux (notice the extra row of output)

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16

github_iconTop GitHub Comments

1reaction
Pessimistresscommented, Feb 23, 2021

Fix is included in 8.5.0-alpha.2.

1reaction
Pessimistresscommented, Feb 21, 2021

That’s actually great to know, thank you for digging into it. 8.5.0-alpha rewrote the DeckGL class component with function and hooks. I’ll make sure it works in strict mode.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Page flickers after before it redirects based on redux value
I have a login page, and what I do is I use redux to map state to props to check if the user...
Read more >
What happened to Components being just a visual thing?
The freeing of the communication between components seems what React Context, Redux and Recoil are solving. Yes, the former is still in the ......
Read more >
Whats so wrong with direct DOM manipulation? : r/javascript
Over the last week I have been experimenting with Vue and React, ... the DOM stuff off so that it can be stored...
Read more >
imodeljs-frontend Change Log - iTwin.js
Allow saved map-layer definition to be edited. Removed unused 'maxZoom' property on ... View.load throws if the input is not a valid Id....
Read more >
SUc - ALBA.Net
Computer service engineer resume sample, Viewstate error dynamic controls, ... Durham university challenge 2012, Arcadia ca map, Bila af minggu 4, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found