-
Notifications
You must be signed in to change notification settings - Fork 529
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 SpanGraph.UNSAFE_componentWillReceiveProps #613
Refactor SpanGraph.UNSAFE_componentWillReceiveProps #613
Conversation
Codecov Report
@@ Coverage Diff @@
## master #613 +/- ##
==========================================
+ Coverage 92.78% 92.84% +0.06%
==========================================
Files 227 227
Lines 5908 5902 -6
Branches 1490 1487 -3
==========================================
- Hits 5482 5480 -2
+ Misses 385 381 -4
Partials 41 41
Continue to review full report at Codecov.
|
7ddb539
to
666e07b
Compare
packages/jaeger-ui/src/components/TracePage/TracePageHeader/SpanGraph/index.tsx
Show resolved
Hide resolved
This looks good, +1 on the memoization! |
packages/jaeger-ui/src/components/TracePage/TracePageHeader/SpanGraph/index.tsx
Show resolved
Hide resolved
This test codifies the sentiments on SpanGraph/index.tsx#L35, confirming that canvas graph is not re-rendered unless trace is changed Signed-off-by: Tim Klever <[email protected]>
Using component state in this manner is considered a react anti-pattern. By removing it, not only is the size and complexity of the component reduced, but it enables the removal of the legacy method UNSAFE_componentWillReceiveProps Signed-off-by: Tim Klever <[email protected]>
666e07b
to
4844d1c
Compare
|
||
export default class SpanGraph extends React.PureComponent<SpanGraphProps> { |
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.
React.PureComponent<SpanGraphProps>
IsSpanGraphProps
still relevant? Seems like it was only affecting constructor/callback.
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.
ah, I guess it affects this.props
in render()
* add test to ensure canvas graph rendering is limited This test codifies the sentiments on SpanGraph/index.tsx#L35, confirming that canvas graph is not re-rendered unless trace is changed Signed-off-by: Tim Klever <[email protected]> * refactor SpanGraph to not use internal state for memoization Using component state in this manner is considered a react anti-pattern. By removing it, not only is the size and complexity of the component reduced, but it enables the removal of the legacy method UNSAFE_componentWillReceiveProps Signed-off-by: Tim Klever <[email protected]> Signed-off-by: vvvprabhakar <[email protected]>
* add test to ensure canvas graph rendering is limited This test codifies the sentiments on SpanGraph/index.tsx#L35, confirming that canvas graph is not re-rendered unless trace is changed Signed-off-by: Tim Klever <[email protected]> * refactor SpanGraph to not use internal state for memoization Using component state in this manner is considered a react anti-pattern. By removing it, not only is the size and complexity of the component reduced, but it enables the removal of the legacy method UNSAFE_componentWillReceiveProps Signed-off-by: Tim Klever <[email protected]> Signed-off-by: vvvprabhakar <[email protected]>
* add test to ensure canvas graph rendering is limited This test codifies the sentiments on SpanGraph/index.tsx#L35, confirming that canvas graph is not re-rendered unless trace is changed Signed-off-by: Tim Klever <[email protected]> * refactor SpanGraph to not use internal state for memoization Using component state in this manner is considered a react anti-pattern. By removing it, not only is the size and complexity of the component reduced, but it enables the removal of the legacy method UNSAFE_componentWillReceiveProps Signed-off-by: Tim Klever <[email protected]> Signed-off-by: vvvprabhakar <[email protected]>
Which problem is this PR solving?
Short description of the changes