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

[READY] Update SuperChart onRenderXXX listeners #6376

Merged
merged 2 commits into from
Nov 29, 2018

Conversation

kristw
Copy link
Contributor

@kristw kristw commented Nov 12, 2018

This PR will improve the accuracy of rendering time logging and also resolve the issue due to out-of-react-cycle execution.

  • Remove skipRendering flag. Check for existence of chartProps instead.
  • Dispatch listener onRenderXXX from the correct place. Before, I was dispatching this from SuperChart which does not have full transparency to when the rendering actually happens because the rendering happens in a nested component created by react-loadable. This PR extends the nested component generated by react-loadable to provide listeners after rendering and use that to trigger onRenderSuccess and onRenderFailure more accurately.
  • Manually trigger preloading of lazy-loaded vis code right after SuperChart knows the chartType. The previous code won't load until chartProps is available

@mistercrunch @williaster @graceguo-supercat @michellethomas @xtinec @conglei

@kristw kristw closed this Nov 12, 2018
@kristw kristw reopened this Nov 12, 2018
@kristw kristw closed this Nov 12, 2018
@kristw kristw reopened this Nov 12, 2018
@codecov-io
Copy link

codecov-io commented Nov 12, 2018

Codecov Report

Merging #6376 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91b758f...36faec0. Read the comment docs.

@kristw kristw changed the title Update SuperChart onRenderXXX listeners [READY] Update SuperChart onRenderXXX listeners Nov 14, 2018
Copy link
Contributor

@williaster williaster left a 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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@kristw kristw force-pushed the kristw-super-chart branch 2 times, most recently from dfdc861 to 6579655 Compare November 17, 2018 05:23
@kristw
Copy link
Contributor Author

kristw commented Nov 19, 2018

Updated and ready for review

Copy link
Contributor

@williaster williaster left a 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!

Squashed commits:
[f1614c7c] extract createLoadableRenderer into a separate function
[8689bc94] extend LoadableRenderer
[3d04ff2b] remove skipRendering
@kristw kristw force-pushed the kristw-super-chart branch from 6579655 to 36faec0 Compare November 20, 2018 19:44
@kristw kristw merged commit e715cdb into apache:master Nov 29, 2018
@kristw kristw deleted the kristw-super-chart branch November 29, 2018 19:09
bipinsoniguavus pushed a commit to ThalesGroup/incubator-superset that referenced this pull request Dec 26, 2018
* 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
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants