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

feat(chart_state): add render change event #365

Merged

Conversation

nickofthyme
Copy link
Collaborator

@nickofthyme nickofthyme commented Sep 3, 2019

Summary

Add render change (onRenderChange) lifecycle hook to Settings.

onRenderChange is a listener to be called when chart render state changes. isRendered value is true when rendering is complete and false otherwise.

Required to implement visualization count for Discover and TSVB.

Screen Recording 2019-08-31 at 11 21 AM

http://localhost:9001/?path=/story/interactions--render-change-action

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

  • Any consumer-facing exports were added to src/index.ts (and stories only import from ../src except for test data & storybook)
  • Proper documentation or storybook story was added for features that require explanation or tutorials
  • Unit tests were updated or added to match the most common scenarios
  • Each commit follows the convention

@nickofthyme nickofthyme added enhancement New feature or request :interactions Interactions related issue labels Sep 3, 2019
@codecov-io
Copy link

codecov-io commented Sep 3, 2019

Codecov Report

Merging #365 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #365      +/-   ##
==========================================
+ Coverage   98.26%   98.27%   +<.01%     
==========================================
  Files          38       38              
  Lines        2772     2782      +10     
  Branches      654      656       +2     
==========================================
+ Hits         2724     2734      +10     
  Misses         44       44              
  Partials        4        4
Impacted Files Coverage Δ
src/specs/settings.tsx 94.44% <100%> (+0.19%) ⬆️
src/chart_types/xy_chart/store/chart_state.ts 97.6% <100%> (+0.04%) ⬆️

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 94d5a51...2375a0e. Read the comment docs.

Copy link
Contributor

@monfera monfera left a comment

Choose a reason for hiding this comment

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

LGTM! The only small addition I wouldn't mind is an explanation of the significance of the true and false values that get emitted

@nickofthyme
Copy link
Collaborator Author

Good point I added the type here but an explanation would be good

export type RenderChangeListener = (isRendered: boolean) => void;

@nickofthyme
Copy link
Collaborator Author

@markov00 when you return, could you please look at this to see if the timing logic is correct?

I was thinking to put the trigger on the mount/update of the reactive_chart component but the timing was virtually identical to observing the chartInitialized value. Let me know what you think.

@nickofthyme nickofthyme merged commit 521889b into elastic:master Sep 4, 2019
@nickofthyme nickofthyme deleted the feat/add-on-chart-render-hook branch September 4, 2019 15:32
markov00 pushed a commit that referenced this pull request Sep 4, 2019
# [11.2.0](v11.1.2...v11.2.0) (2019-09-04)

### Features

* **chart_state:** add render change event ([#365](#365)) ([521889b](521889b))
@markov00
Copy link
Member

markov00 commented Sep 4, 2019

🎉 This PR is included in version 11.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Sep 4, 2019
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request :interactions Interactions related issue released Issue released publicly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants