Skip to content

Conversation

ntucker
Copy link
Collaborator

@ntucker ntucker commented Oct 5, 2025

Motivation

Sometimes you don't have the discriminator, but there's no reason you can't still useQuery

Solution

Before

const event = useQuery(EventUnion, { id });
// is undefined
const newsEvent = useQuery(EventUnion, { id, type: 'news' });
// found

After

const event = useQuery(EventUnion, { id });
// found
const newsEvent = useQuery(EventUnion, { id, type: 'news' });
// found

Copy link

changeset-bot bot commented Oct 5, 2025

🦋 Changeset detected

Latest commit: 6059510

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

This PR includes changesets to release 10 packages
Name Type
@data-client/normalizr Patch
@data-client/endpoint Patch
@data-client/react Patch
@data-client/core Patch
@data-client/rest Patch
@data-client/graphql Patch
example-benchmark Patch
normalizr-github-example Patch
normalizr-redux-example Patch
normalizr-relationships 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

codecov bot commented Oct 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.26%. Comparing base (beaa03e) to head (6059510).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3558   +/-   ##
=======================================
  Coverage   98.26%   98.26%           
=======================================
  Files         130      130           
  Lines        2245     2249    +4     
  Branches      452      453    +1     
=======================================
+ Hits         2206     2210    +4     
  Misses         10       10           
  Partials       29       29           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

github-actions bot commented Oct 5, 2025

Size Change: +11 B (+0.01%)

Total Size: 77.7 kB

ℹ️ View Unchanged
Filename Size Change
examples/test-bundlesize/dist/App.js 3.42 kB 0 B
examples/test-bundlesize/dist/polyfill.js 311 B 0 B
examples/test-bundlesize/dist/rdcClient.js 10.1 kB +4 B (+0.04%)
examples/test-bundlesize/dist/rdcEndpoint.js 5.62 kB +7 B (+0.12%)
examples/test-bundlesize/dist/react.js 57.5 kB 0 B
examples/test-bundlesize/dist/webpack-runtime.js 726 B 0 B

compressed-size-action

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: 6059510 Previous: beaa03e Ratio
normalizeLong 528 ops/sec (±1.42%) 529 ops/sec (±1.21%) 1.00
denormalizeLong 282 ops/sec (±3.42%) 275 ops/sec (±2.81%) 0.98
denormalizeLong donotcache 1032 ops/sec (±1.00%) 996 ops/sec (±0.28%) 0.97
denormalizeShort donotcache 500x 1627 ops/sec (±0.14%) 1609 ops/sec (±0.17%) 0.99
denormalizeShort 500x 863 ops/sec (±1.70%) 865 ops/sec (±1.70%) 1.00
denormalizeShort 500x withCache 6744 ops/sec (±0.16%) 6361 ops/sec (±0.16%) 0.94
queryShort 500x withCache 2763 ops/sec (±1.13%) 2705 ops/sec (±0.09%) 0.98
buildQueryKey All 55263 ops/sec (±0.42%) 55207 ops/sec (±0.45%) 1.00
query All withCache 8217 ops/sec (±0.37%) 6693 ops/sec (±0.57%) 0.81
denormalizeLong with mixin Entity 282 ops/sec (±1.97%) 352 ops/sec (±0.58%) 1.25
denormalizeLong withCache 7160 ops/sec (±0.15%) 6774 ops/sec (±0.20%) 0.95
denormalizeLong All withCache 8076 ops/sec (±0.15%) 6409 ops/sec (±0.13%) 0.79
denormalizeLong Query-sorted withCache 8356 ops/sec (±0.18%) 6756 ops/sec (±0.09%) 0.81
denormalizeLongAndShort withEntityCacheOnly 1724 ops/sec (±0.19%) 1701 ops/sec (±0.21%) 0.99
getResponse 5774 ops/sec (±1.44%) 5614 ops/sec (±1.41%) 0.97
getResponse (null) 7202164 ops/sec (±1.09%) 7044933 ops/sec (±0.80%) 0.98
getResponse (clear cache) 278 ops/sec (±1.87%) 346 ops/sec (±0.52%) 1.24
getSmallResponse 3120 ops/sec (±0.22%) 3098 ops/sec (±0.12%) 0.99
getSmallInferredResponse 2366 ops/sec (±0.14%) 2308 ops/sec (±0.12%) 0.98
getResponse Collection 5643 ops/sec (±1.44%) 5643 ops/sec (±1.47%) 1
get Collection 5624 ops/sec (±0.22%) 5847 ops/sec (±0.65%) 1.04
get Query-sorted 6455 ops/sec (±0.40%) 5381 ops/sec (±0.23%) 0.83
setLong 529 ops/sec (±0.25%) 540 ops/sec (±0.20%) 1.02
setLongWithMerge 240 ops/sec (±1.22%) 241 ops/sec (±0.25%) 1.00
setLongWithSimpleMerge 261 ops/sec (±0.29%) 253 ops/sec (±0.87%) 0.97
setSmallResponse 500x 933 ops/sec (±0.32%) 934 ops/sec (±0.22%) 1.00

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

@ntucker ntucker force-pushed the union-query branch 5 times, most recently from ae40d2d to dddc16e Compare October 5, 2025 18:40
@ntucker ntucker merged commit fcb7d7d into master Oct 5, 2025
23 checks passed
@ntucker ntucker deleted the union-query branch October 5, 2025 19:13
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.

1 participant