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

fix(deck.gl): update view state on property changes (#17720) #17826

Merged
merged 2 commits into from
Feb 11, 2022

Conversation

hbruch
Copy link
Contributor

@hbruch hbruch commented Dec 20, 2021

SUMMARY

Updates viewport state of deck.gl on filter updates

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before (screeshot 1 & 2):
grafik
grafik

After:

update_viewport_480.mov

TESTING INSTRUCTIONS

  1. Create a Dashboard containing a deck.gl polygon chart (auto zoom = True) with a column included in filter
  2. Open the dahsboard => the map is zoomed according to show features (screenshot 1)
  3. Change native filter value
  4. The map is now zoomed to the new bounding box (see video)

ADDITIONAL INFORMATION

@codecov
Copy link

codecov bot commented Dec 20, 2021

Codecov Report

Merging #17826 (dbbfec7) into master (6991417) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17826      +/-   ##
==========================================
- Coverage   67.07%   67.07%   -0.01%     
==========================================
  Files        1609     1609              
  Lines       64899    64901       +2     
  Branches     6866     6867       +1     
==========================================
  Hits        43533    43533              
- Misses      19500    19502       +2     
  Partials     1866     1866              
Flag Coverage Δ
javascript 53.76% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...legacy-preset-chart-deckgl/src/DeckGLContainer.jsx 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6991417...dbbfec7. Read the comment docs.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! Works well, but minor performance improvement suggestion

@@ -64,6 +64,12 @@ export class DeckGLContainer extends React.Component {
};
}

UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.viewport !== this.props.viewport) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this will cause unnecessary rerenders as the object reference may change despite its properties being unchanged. Let's use lodash here, something like

import { isEqual } from 'lodash';

if (!isEqual(nextProps.viewport, this.props.viewport)) {
  ...
},

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the hint. Is adressed by last commit (though checks failed again)...

@villebro
Copy link
Member

villebro commented Jan 4, 2022

@hbruch can you rebase this? I believe there may have been some CI issues when you pushed these last changes

@villebro
Copy link
Member

villebro commented Jan 4, 2022

@hbruch sorry about this, but there's yet some more flakiness in our CI pipeline: #17918 . Bear with us while we get it sorted..

@hbruch
Copy link
Contributor Author

hbruch commented Feb 11, 2022

@villebro Is there anything I could do to have this merged? Thx

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry about the delay!

@villebro villebro merged commit 97d918b into apache:master Feb 11, 2022
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 this pull request may close these issues.

deck.gl polygon doesn't auto zoom to changed bounds when native filter is updated
2 participants