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: Add controller.set() #3105

Merged
merged 1 commit into from
Jun 17, 2024
Merged

feat: Add controller.set() #3105

merged 1 commit into from
Jun 17, 2024

Conversation

ntucker
Copy link
Collaborator

@ntucker ntucker commented Jun 17, 2024

Motivation

Make it easier to work with entities to unlock the full power of data-client's store.

This is especially useful when building streaming data clients for websockets and SSE. For example the https://github.com/reactive/coin-app will be using it.

Solution

Add controller.set()

ctrl.set(Todo, { id: '5' }, { id: '5', title: 'tell me friends how great Data Client is' });

BREAKING CHANGE:

  • actionTypes.SET_TYPE -> actionTypes.SET_RESPONSE_TYPE
  • SetAction -> SetResponseAction

Copy link

changeset-bot bot commented Jun 17, 2024

🦋 Changeset detected

Latest commit: 9422a1e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@data-client/test Minor
@data-client/img Minor
@data-client/ssr Patch
@data-client/react Minor
@data-client/core Minor
coinbase-lite Patch
example-benchmark Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: 9422a1e Previous: aab27d9 Ratio
normalizeLong 420 ops/sec (±1.86%) 436 ops/sec (±1.89%) 1.04
infer All 9442 ops/sec (±0.76%) 9422 ops/sec (±1.52%) 1.00
denormalizeLong 333 ops/sec (±1.19%) 320 ops/sec (±2.72%) 0.96
denormalizeLong donotcache 856 ops/sec (±1.39%) 898 ops/sec (±0.25%) 1.05
denormalizeShort donotcache 500x 1224 ops/sec (±0.20%) 1358 ops/sec (±0.16%) 1.11
denormalizeShort 500x 966 ops/sec (±0.29%) 986 ops/sec (±0.16%) 1.02
denormalizeShort 500x withCache 4683 ops/sec (±0.85%) 4938 ops/sec (±0.25%) 1.05
denormalizeLong with mixin Entity 284 ops/sec (±0.90%) 298 ops/sec (±0.48%) 1.05
denormalizeLong withCache 5962 ops/sec (±0.28%) 6659 ops/sec (±0.56%) 1.12
denormalizeLong All withCache 6637 ops/sec (±0.24%) 6442 ops/sec (±0.19%) 0.97
denormalizeLong Query-sorted withCache 6430 ops/sec (±0.48%) 6155 ops/sec (±1.03%) 0.96
denormalizeLongAndShort withEntityCacheOnly 1461 ops/sec (±0.85%) 1498 ops/sec (±0.26%) 1.03
getResponse 5690 ops/sec (±0.78%) 6377 ops/sec (±1.38%) 1.12
getResponse (null) 5589094 ops/sec (±0.44%) 6003637 ops/sec (±0.95%) 1.07
getResponse (clear cache) 282 ops/sec (±1.13%) 295 ops/sec (±0.48%) 1.05
getSmallResponse 2567 ops/sec (±0.27%) 2692 ops/sec (±0.19%) 1.05
getSmallInferredResponse 2029 ops/sec (±0.27%) 1995 ops/sec (±0.19%) 0.98
getResponse Query-sorted 5338 ops/sec (±0.87%) 5545 ops/sec (±0.71%) 1.04
getResponse Collection 6298 ops/sec (±0.89%) 6655 ops/sec (±1.21%) 1.06
get Collection 5309 ops/sec (±1.17%) 5544 ops/sec (±1.05%) 1.04
setLong 425 ops/sec (±2.22%) 439 ops/sec (±2.25%) 1.03
setLongWithMerge 179 ops/sec (±1.70%) 182 ops/sec (±1.48%) 1.02
setLongWithSimpleMerge 181 ops/sec (±1.64%) 182 ops/sec (±1.62%) 1.01
setSmallResponse 500x 840 ops/sec (±1.46%) 843 ops/sec (±1.31%) 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Copy link

codecov bot commented Jun 17, 2024

Codecov Report

Attention: Patch coverage is 98.64865% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.78%. Comparing base (dc67eff) to head (9422a1e).

Files Patch % Lines
...kages/core/src/state/reducer/setResponseReducer.ts 97.36% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3105      +/-   ##
==========================================
+ Coverage   98.72%   98.78%   +0.05%     
==========================================
  Files         123      125       +2     
  Lines        2204     2230      +26     
  Branches      452      453       +1     
==========================================
+ Hits         2176     2203      +27     
+ Misses         17       16       -1     
  Partials       11       11              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ntucker ntucker force-pushed the ctrl.set branch 3 times, most recently from 6c72677 to 2978be0 Compare June 17, 2024 13:02
@ntucker ntucker merged commit cf770de into master Jun 17, 2024
26 checks passed
@ntucker ntucker deleted the ctrl.set branch June 17, 2024 13:25
@github-actions github-actions bot mentioned this pull request Jun 17, 2024
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

1 participant