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

refactor: Heatmap chart instance management #749

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

tihuan
Copy link
Contributor

@tihuan tihuan commented Feb 14, 2024

Summary

Structural Element (Base, Gene, DNA, Chromosome or Cell)
Github issue: #XXXX
Copy issue description here

Checklist

  • Default Story in Storybook
  • LivePreview Story in Storybook
  • Test Story in Storybook
  • Tests written
  • Variables from defaultTheme.ts used wherever possible
  • If updating an existing component, depreciate flag has been used where necessary
  • Chromatic build verified by @chanzuckerberg/sds-design

@tihuan tihuan requested a review from masoudmanson February 14, 2024 22:29
@tihuan tihuan mentioned this pull request Feb 14, 2024
14 tasks
Copy link
Contributor

@masoudmanson masoudmanson left a comment

Choose a reason for hiding this comment

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

This is fantastic! I really appreciate your help with this. It looks good to me; however, I have one question, which I've added as a comment. Thanks again, @tihuan!

/**
* (thuang): Use this ref to store the onEvents prop to prevent
* unnecessary re-renders when the onEvents prop changes.
* NOTE: This implies that `onEvents` prop changes alone from the parent
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this potentially cause issues later on?
I mean the fact that changing the onEvents won't trigger re-renders as you've mentioned!

Copy link
Contributor Author

@tihuan tihuan Feb 15, 2024

Choose a reason for hiding this comment

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

Yeah I was debating about this too 🤔

Really about finding a balance between UX (asking users to useCallback() and useMemo() to memoize their onEvents object, vs. performance (re-render every time onEvents changes or not)

I think in this case it feels like the event handlers are less likely to change (besides users re-creating the object every time) than data being passed, so I feel it's probably an okay tradeoff here?

Also I think the current implementation in this PR also ignores all the prop changes except for [echartsRendererMode] as well, so changing onEvents also won't re-render the chart, so behavior wise it should be the same as the current PR!

@masoudmanson masoudmanson merged commit 67bebe0 into 634-base-heatmap-build Feb 15, 2024
10 checks passed
@masoudmanson masoudmanson deleted the thuang-634-feedback branch February 15, 2024 18:23
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.

2 participants