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

Update widget when setStats #93

Merged
merged 1 commit into from
Aug 26, 2019
Merged

Update widget when setStats #93

merged 1 commit into from
Aug 26, 2019

Conversation

xintongxia
Copy link
Contributor

@xintongxia xintongxia commented Aug 25, 2019

  • Update widget when setStats
  • Add more tests

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 49.204% when pulling 987f410 on xx/widget-impr into 6b69db2 on master.

container.id = 'test-stats-widget-container';
const statsWidget = new StatsWidget(null, {
container,
resetOnUpdate: {Count: true}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The StatWidget.props.resetOnUpdate interface seems non-optimal... wouldn't it would be more natural to set such flags directly on each stat definition in the stat object, rather than maintaining a separate map in the stats widget?

new Stats({
  id, 
  stats: {
    count: {name: 'Count', type: 'count', resetOnUpdate: true}
  }
});

In addition, having this as an option on the stats widget again forces applications to know something about the stats inside the stats object, and adds extra lines of code clutter to apps that just want to present the stats in an "opaque" stats object in their UI.

We moved the types / formatting information to avoid apps having to specify it, now we are adding new things for apps to specify...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do a follow up PR to refactor

@xintongxia xintongxia merged commit 292f43f into master Aug 26, 2019
@xintongxia xintongxia deleted the xx/widget-impr branch August 26, 2019 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants