Skip to content

feat: Add Collection.remove#3560

Merged
ntucker merged 1 commit intomasterfrom
collection-remove
Oct 6, 2025
Merged

feat: Add Collection.remove#3560
ntucker merged 1 commit intomasterfrom
collection-remove

Conversation

@ntucker
Copy link
Collaborator

@ntucker ntucker commented Oct 6, 2025

Motivation

Invalidate() removes everywhere, but what if we want to just remove from one collection and keep in others?

https://backbonejs.org/#Collection-remove

Solution

  • Response: Take input like Invalidate (either pk directly or an object to run pk on)
  • Usage: Operate like push/unshift/assign (TodoResource.getList.remove({ id: ‘5’ }))
ctrl.set(MyResource.getList.schema.remove, { id });

or

ctrl.fetch(MyResource.getList.remove, { id });

Open questions

  • What about Values?
  • What about RestEndpoint extenders? (like getList.push)

@changeset-bot
Copy link

changeset-bot bot commented Oct 6, 2025

🦋 Changeset detected

Latest commit: afa6b9d

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/endpoint Patch
@data-client/graphql Patch
@data-client/rest 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

@ntucker ntucker force-pushed the collection-remove branch from 26b6665 to 5923aea Compare October 6, 2025 02:03
@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2025

Size Change: +21 B (+0.03%)

Total Size: 77.7 kB

Filename Size Change
examples/test-bundlesize/dist/rdcEndpoint.js 5.64 kB +21 B (+0.37%)
ℹ️ View Unchanged
Filename Size
examples/test-bundlesize/dist/App.js 3.42 kB
examples/test-bundlesize/dist/polyfill.js 311 B
examples/test-bundlesize/dist/rdcClient.js 10.1 kB
examples/test-bundlesize/dist/react.js 57.5 kB
examples/test-bundlesize/dist/webpack-runtime.js 726 B

compressed-size-action

@ntucker ntucker force-pushed the collection-remove branch from 5923aea to afa6b9d Compare October 6, 2025 02:06
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

Details
Benchmark suite Current: afa6b9d Previous: fcb7d7d Ratio
normalizeLong 517 ops/sec (±1.03%) 534 ops/sec (±1.55%) 1.03
denormalizeLong 294 ops/sec (±2.23%) 280 ops/sec (±3.25%) 0.95
denormalizeLong donotcache 1042 ops/sec (±0.28%) 1024 ops/sec (±1.00%) 0.98
denormalizeShort donotcache 500x 1616 ops/sec (±0.11%) 1618 ops/sec (±0.09%) 1.00
denormalizeShort 500x 867 ops/sec (±1.88%) 846 ops/sec (±1.78%) 0.98
denormalizeShort 500x withCache 6611 ops/sec (±0.12%) 6722 ops/sec (±0.12%) 1.02
queryShort 500x withCache 2796 ops/sec (±0.09%) 2682 ops/sec (±0.08%) 0.96
buildQueryKey All 55501 ops/sec (±0.65%) 55354 ops/sec (±0.38%) 1.00
query All withCache 6662 ops/sec (±0.21%) 7343 ops/sec (±0.32%) 1.10
denormalizeLong with mixin Entity 274 ops/sec (±2.33%) 276 ops/sec (±2.37%) 1.01
denormalizeLong withCache 6484 ops/sec (±0.21%) 6797 ops/sec (±0.22%) 1.05
denormalizeLong All withCache 6441 ops/sec (±0.38%) 7209 ops/sec (±0.15%) 1.12
denormalizeLong Query-sorted withCache 6698 ops/sec (±0.17%) 7446 ops/sec (±1.13%) 1.11
denormalizeLongAndShort withEntityCacheOnly 1727 ops/sec (±0.24%) 1707 ops/sec (±0.18%) 0.99
getResponse 5603 ops/sec (±1.28%) 5647 ops/sec (±1.42%) 1.01
getResponse (null) 6675063 ops/sec (±0.49%) 6765613 ops/sec (±0.65%) 1.01
getResponse (clear cache) 279 ops/sec (±2.12%) 273 ops/sec (±1.87%) 0.98
getSmallResponse 3100 ops/sec (±0.10%) 3076 ops/sec (±0.12%) 0.99
getSmallInferredResponse 2314 ops/sec (±0.40%) 2304 ops/sec (±0.12%) 1.00
getResponse Collection 5511 ops/sec (±1.02%) 5560 ops/sec (±1.11%) 1.01
get Collection 5526 ops/sec (±0.30%) 5651 ops/sec (±0.26%) 1.02
get Query-sorted 6409 ops/sec (±0.72%) 6771 ops/sec (±0.21%) 1.06
setLong 527 ops/sec (±0.26%) 553 ops/sec (±0.17%) 1.05
setLongWithMerge 244 ops/sec (±0.20%) 243 ops/sec (±0.64%) 1.00
setLongWithSimpleMerge 252 ops/sec (±0.42%) 261 ops/sec (±0.09%) 1.04
setSmallResponse 500x 947 ops/sec (±0.09%) 944 ops/sec (±0.08%) 1.00

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

@codecov
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3560   +/-   ##
=======================================
  Coverage   98.26%   98.26%           
=======================================
  Files         130      130           
  Lines        2249     2252    +3     
  Branches      453      453           
=======================================
+ Hits         2210     2213    +3     
  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.

@ntucker ntucker merged commit ba31c9b into master Oct 6, 2025
24 checks passed
@ntucker ntucker deleted the collection-remove branch October 6, 2025 02:11
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