-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
[READY] Update SuperChart onRenderXXX listeners #6376
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6376 +/- ##
=======================================
Coverage 73.37% 73.37%
=======================================
Files 67 67
Lines 9585 9585
=======================================
Hits 7033 7033
Misses 2552 2552 Continue to review full report at Codecov.
|
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.
Looks great overall, I had one suggestion about splitting the custom renderer as it's a little hard to follow.
// Extends the behavior of LoadableComponent | ||
// generated by react-loadable | ||
// to provide post-render listeners | ||
class CustomLoadableRenderer extends LoadableRenderer { |
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 seems a little heavy to put inside the component, inside a selector. Could we instead create a factory as an external file and pass it config? it's a bummer they don't have a post-load hook.
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. Wish they have a post-load hook. This is a bit fragile if they change how it is written.
Anyway, good call on separating into another factory file. Will do that.
if (skipRendering || !chartProps) { | ||
// Do not render if chartProps is not available. | ||
// but the pre-loading has been started in this.createLoadableRenderer | ||
// to prepare for rendering once chartProps becomes available. |
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.
👍
dfdc861
to
6579655
Compare
Updated and ready for review |
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 looks great! much easier to follow in separate files I think 👍
had a question about the afterRender
calls but pending that I think it's good to go!
superset/assets/spec/javascripts/visualizations/core/createLoadableRenderer_spec.jsx
Outdated
Show resolved
Hide resolved
superset/assets/src/visualizations/core/components/createLoadableRenderer.js
Show resolved
Hide resolved
Squashed commits: [f1614c7c] extract createLoadableRenderer into a separate function [8689bc94] extend LoadableRenderer [3d04ff2b] remove skipRendering
6579655
to
36faec0
Compare
* Revise LoadableRenderer (+3 squashed commits) Squashed commits: [f1614c7c] extract createLoadableRenderer into a separate function [8689bc94] extend LoadableRenderer [3d04ff2b] remove skipRendering * add number of times function was called to the test
This PR will improve the accuracy of rendering time logging and also resolve the issue due to out-of-react-cycle execution.
skipRendering
flag. Check for existence ofchartProps
instead.onRenderXXX
from the correct place. Before, I was dispatching this fromSuperChart
which does not have full transparency to when the rendering actually happens because the rendering happens in a nested component created byreact-loadable
. This PR extends the nested component generated byreact-loadable
to provide listeners after rendering and use that to triggeronRenderSuccess
andonRenderFailure
more accurately.preloading
of lazy-loaded vis code right afterSuperChart
knows thechartType
. The previous code won't load untilchartProps
is available@mistercrunch @williaster @graceguo-supercat @michellethomas @xtinec @conglei