Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @dmfalke (and @bobular):
As commented at #597 (comment) about a bug concerning the bubble marker, I tried to find the reason and fix the bug. After delving into the issue, I realized that it was because marker data is prefetched via useQuery while the legendData via useLegendData hook is still being undefined. This leads the bubble markers to be not shown: more specifically all the marker data have 0 diameters & no colors due to undefined bubbleValueToColorMapper & bubbleValueToDiameterMapper functions at legendData. After sleeping on this, I finally found two possible solutions as follows:
a) Based on the pre-existing comment by Dave, "FIXME Don't make dependent on legend data", I tried to move legendData and the relevant parts to use legendData, i.e., finalMarkerData, out of useMarkerData, i.e. move them to the parent where useMarkerData is called, and then adjusted the parent accordingly. Based on my tests, this worked fine.
b) That being said, an idea came to my mind as an alternative solution after a while. So, basically this can also be considered as an issue of not calling useQuery again (refetch) when legendData is ready (not undefined), thus I changed the conditions of "enabled" option used in the useQuery by additionally checking if legendData is undefined. Certainly, this is much simpler solution than a) and I confirmed that this also worked out.
Due to simplicity, I made PR for b). What do you think @dmfalke?