-
Notifications
You must be signed in to change notification settings - Fork 855
Added feature: update heat map on data change + fix linting #593
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
Added feature: update heat map on data change + fix linting #593
Conversation
@DonovanDeSmedt Great work dude! Do you mind adding a quick video showing it works? @ZAKdev as you were the one who added heatmap and you work often with it, do you mind taking a quick look? |
@itsmichaeldiego thx, was quiet busy last week, I'll make a video tomorrow. |
A small example video of this feature: Only negative point that could be improved is the visual rerender of the map (map becomes grey for a second before a rerender). It would improve the UX if the map would rerender smoothly, without a visual grey interval... |
src/google_map.js
Outdated
this._isCenterDefined(nextProps.center) | ||
(!this._isCenterDefined(this.props.center) && | ||
this._isCenterDefined(nextProps.center)) || | ||
this.props.updateHeatmap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is perfect, I am wondering if we could add this logic into another block to make it clearer, something like:
if (this.props.updateHeatmap) {
this.initialized_ = this.props.updateHeatmap ? false : this.initialized_;
setTimeout(() => this._initMap(), 0);
}
That we we don't call this.initialized_ = this.props.updateHeatmap ? false : this.initialized_;
everytime we change the center. I know we repeat the code setTimeout(() => this._initMap(), 0);
but I don't see it that bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I am a bit worried, my dear friend @istarkov left a comment here that map should be initialized only once, I am pretty sure there is a way to achieve updating the map without re-initializing it, I think that is the reason why the map becomes grey for a second before a rerender, this also will affect the performance of your app, would you like to work on this together to find the best way to do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's what I thought. It's a quick 'fix' for the moment but there should be a better way to implement this. I'll try to look into it.
@DonovanDeSmedt BTW, I just fixed the build and in order to do so I've to fix the linter, so you might have to rebase and remove the fix linting comment. Let me know if you don't have time and I can do it for you. |
When prop updateHeatmap is set to true --> map will rerender. - New render of <GoogleMapReact> and data is changed, prop updateHeatmap should be true - New render of <GoogleMapReact> and data is not changed, prop updateHeatmap should be false
Feel free to do it for me, I messed up some things locally :( |
…ateHeatmap equals true
3fe4444
to
6344453
Compare
Added support for extra google map api libraries:
Updated the rerender of heatmap when the prop updateHeatmap is set to true (no more flickering). Map is just being rerendered without being initialised again. |
@DonovanDeSmedt Great work man! I might need you to add it to the documentation so users know that this is a possibility! (To use this libraries). And I will create a minor release asap. |
@itsmichaeldiego Indeed, that's necessary. I'll update the documentation in the readme. |
@DonovanDeSmedt Thanks! Looking forward for it! |
- added info about the use of other libraries in the Google Map API - added info about the updateHeatmap prop
@itsmichaeldiego Can you check the updated readme to verify there is enough information about the change in this pr? |
@DonovanDeSmedt Looks great, thanks man! I will merge it soon |
@DonovanDeSmedt Merged and deployed in version |
@DonovanDeSmedt This created an issue: #673 Let me know if you can take a look at that, because the older way of using libraries stopped working Maybe we should change the approach to use heatmapLibrary the same way we used to add the libraries in the URL:
|
Ok, I'll update it, by the weekend at the latest. Correct way:
Wrong way:
|
@DonovanDeSmedt Lets just use the "correct way" :D |
OMG! I can't believe you changed an important API without any notice, updating docs and release log. This is super critical and ppl are using this component in a serious business and product. Please bring back the wrong way, anyway. |
* 'master' of github.com:google-map-react/google-map-react: Bump to 1.1.1 (google-map-react#680) Revert "Added feature: update heat map on data change + fix linting" (google-map-react#679) Bump version to 1.1.0 (google-map-react#671) Added feature: update heat map on data change + fix linting (google-map-react#593) Pass map instance to onDrag handler (google-map-react#656) add math abs to avoid negative values when calculating zoom (google-map-react#655) Bump version to 1.0.9 (google-map-react#651) Custom div style options (google-map-react#634) Bump version to 1.0.8 (google-map-react#646) Revert 643 fix/map context (google-map-react#645) Bump version to 1.0.7 (google-map-react#644) Add passive scroll (google-map-react#631) Use React 16 portal to render map overlay (google-map-react#643) Fix old examples links and add one to new examples (google-map-react#633) Bump version to 1.0.6 (google-map-react#621) Add prop `onTilesLoaded` (google-map-react#615) Fix typo, and call fromContainerPixelToLatLng() as you would expect. (google-map-react#620) Update API.md (google-map-react#611) Upgrade version to 1.0.5 (google-map-react#607) Remove marker jiggle. (google-map-react#603)
The new implemenation of loading libraries was added to be consistent with the heatmap library (as described in the api docs).
This implementation no longer supported the previous way
It was released in release 1.1.0 but it should indeed be backward compatible. Hence my pr to fix this issue (and support both ways) if that's wanted. |
Thanks @DonovanDeSmedt! Great input, I already answered in your PR, I think the heatmap change was created a few months back by @ZAKdev and I did not remember that we already had another way to handle libraries, that was my mistake. I would keep it the old way, just importing libraries with the array. |
@snhasani We fixed this and released |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
When prop updateHeatmap is set to true --> map will rerender.