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 React state update warning #968

Merged
merged 1 commit into from
Dec 30, 2019
Merged

Fix React state update warning #968

merged 1 commit into from
Dec 30, 2019

Conversation

Pessimistress
Copy link
Collaborator

For #872

  • Avoid calling onViewportChange during render (move to componentDidUpdate)
  • Fix an issue during initial MapController.setOptions -- we were always calling onViewportChange because oldViewport was empty.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 39.153% when pulling 104182c on x/react-warning into 747f414 on master.

@@ -176,12 +176,14 @@ export default class MapController {
this.onViewportChange = onViewportChange;
this.onStateChange = onStateChange;

if (!this.mapStateProps || this.mapStateProps.height !== options.height) {
const dimensionChanged = !this.mapStateProps || this.mapStateProps.height !== options.height;

Choose a reason for hiding this comment

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

Don't need check whether width changed here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Width does not affect normalization. A map may need to be scaled and shifted vertically to fill the height.

@Pessimistress Pessimistress merged commit 28f0b6e into master Dec 30, 2019
@Pessimistress Pessimistress deleted the x/react-warning branch December 30, 2019 23:22
Pessimistress added a commit that referenced this pull request Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants