Thanks to visit codestin.com
Credit goes to github.com

Skip to content

enhance: ImmutableJS support moved to /immutable export #3468

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

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

ntucker
Copy link
Collaborator

@ntucker ntucker commented Apr 10, 2025

BREAKING CHANGE: To use

Follow up to #3449

Motivation

Solution

  • delegate.getEntities()
  • new MemoCache(ImmutableDelegate)

Copy link

changeset-bot bot commented Apr 10, 2025

⚠️ No Changeset found

Latest commit: 0e30d7c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link
Contributor

github-actions bot commented Apr 10, 2025

Size Change: -104 B (-0.13%)

Total Size: 77.6 kB

Filename Size Change
examples/test-bundlesize/dist/rdcClient.js 10.1 kB -109 B (-1.07%)
ℹ️ 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/rdcEndpoint.js 5.6 kB +5 B (+0.09%)
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

codecov bot commented Apr 10, 2025

Codecov Report

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

Project coverage is 98.75%. Comparing base (e15d2af) to head (a477670).

Files with missing lines Patch % Lines
packages/core/src/state/GCPolicy.ts 90.90% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3468   +/-   ##
=======================================
  Coverage   98.74%   98.75%           
=======================================
  Files         124      128    +4     
  Lines        2239     2247    +8     
  Branches      460      455    -5     
=======================================
+ Hits         2211     2219    +8     
  Misses         13       13           
  Partials       15       15           

☔ 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 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: 0e30d7c Previous: c1c3fac Ratio
normalizeLong 521 ops/sec (±1.38%) 505 ops/sec (±1.36%) 0.97
infer All 9409 ops/sec (±1.09%) 9093 ops/sec (±1.81%) 0.97
denormalizeLong 277 ops/sec (±3.58%) 279 ops/sec (±3.36%) 1.01
denormalizeLong donotcache 1000 ops/sec (±0.38%) 1000 ops/sec (±0.45%) 1
denormalizeShort donotcache 500x 1480 ops/sec (±0.16%) 1438 ops/sec (±0.31%) 0.97
denormalizeShort 500x 805 ops/sec (±2.25%) 787 ops/sec (±2.12%) 0.98
denormalizeShort 500x withCache 6357 ops/sec (±0.54%) 5336 ops/sec (±0.24%) 0.84
queryShort 500x withCache 2857 ops/sec (±0.31%) 2348 ops/sec (±0.23%) 0.82
denormalizeLong with mixin Entity 269 ops/sec (±1.91%) 256 ops/sec (±1.98%) 0.95
denormalizeLong withCache 7024 ops/sec (±0.23%) 6643 ops/sec (±0.26%) 0.95
denormalizeLong All withCache 7184 ops/sec (±0.26%) 8191 ops/sec (±0.34%) 1.14
denormalizeLong Query-sorted withCache 6877 ops/sec (±0.68%) 7915 ops/sec (±0.66%) 1.15
denormalizeLongAndShort withEntityCacheOnly 1742 ops/sec (±0.44%) 1707 ops/sec (±0.46%) 0.98
getResponse 6831 ops/sec (±0.77%) 6008 ops/sec (±1.28%) 0.88
getResponse (null) 7548747 ops/sec (±0.84%) 5985961 ops/sec (±0.65%) 0.79
getResponse (clear cache) 271 ops/sec (±1.97%) 259 ops/sec (±2.05%) 0.96
getSmallResponse 3076 ops/sec (±0.41%) 2697 ops/sec (±0.29%) 0.88
getSmallInferredResponse 2200 ops/sec (±0.53%) 2081 ops/sec (±0.10%) 0.95
getResponse Collection 6558 ops/sec (±0.93%) 6830 ops/sec (±1.08%) 1.04
get Collection 5902 ops/sec (±0.36%) 6065 ops/sec (±0.53%) 1.03
get Query-sorted 7468 ops/sec (±0.30%) 6706 ops/sec (±0.30%) 0.90
setLong 532 ops/sec (±0.22%) 498 ops/sec (±0.52%) 0.94
setLongWithMerge 233 ops/sec (±0.41%) 230 ops/sec (±0.38%) 0.99
setLongWithSimpleMerge 248 ops/sec (±0.23%) 243 ops/sec (±0.48%) 0.98
setSmallResponse 500x 914 ops/sec (±0.32%) 920 ops/sec (±0.33%) 1.01

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

@ntucker ntucker force-pushed the imm-denorm branch 11 times, most recently from 36683fd to a477670 Compare April 15, 2025 16:21
@ntucker ntucker requested a review from Copilot May 1, 2025 03:59
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances ImmutableJS support by updating various components to use new Delegate patterns and adjusting related API calls. Key changes include:

  • Consolidating type imports and modifying local cache retrievals.
  • Replacing direct entity retrieval calls with new delegate calls in both normalization and denormalization.
  • Updating tests to use the new delegate parameters for MemoCache queries.

Reviewed Changes

Copilot reviewed 41 out of 42 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/normalizr/src/denormalize/localCache.ts Adjusted import refinements and non-null assertion on cache retrieval.
packages/normalizr/src/denormalize/getEntities.ts Updated delegate usage and return type to support symbol keys.
packages/normalizr/src/denormalize/denormalize.ts Replaced getEntities call with PlainDelegate and removed isImmutable flag from getUnvisit.
packages/normalizr/src/denormalize/denormalize.immutable.ts Added new immutable-specific denormalization implementation.
packages/normalizr/src/denormalize/cache.ts Simplified type imports.
packages/normalizr/src/denormalize/UNDEF.ts Updated UNDEF constant with type assertion to any.
Various test files Updated MemoCache instantiation and delegate usage in tests.
packages/endpoint and packages/core files Refactored entity lookup and GCPolicy iteration using destructuring for clarity.
packages/endpoint/src/interface.ts Expanded IQueryDelegate and INormalizeDelegate definitions to include getEntities.
packages/endpoint/src/index.ts Re-exported all interface types for consistency.
Files not reviewed (1)
  • packages/normalizr/package.json: Language not supported
Comments suppressed due to low confidence (1)

packages/normalizr/src/denormalize/denormalize.ts:19

  • The removal of the isImmutable(entities) argument in the getUnvisit call may alter the behavior if getUnvisit depends on this flag for handling immutable data. Please verify that this change is intentional and that getUnvisit no longer requires an explicit immutable indicator.
return getUnvisit(PlainDelegate.forDenorm(entities), new LocalCache(), args, )(schema, input).data;

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