Skip to content

feat(store): error in dev mode when selectSignal selector returns new reference with identical value#2441

Merged
arturovt merged 1 commit into
masterfrom
feat/error-dev-mode
May 7, 2026
Merged

feat(store): error in dev mode when selectSignal selector returns new reference with identical value#2441
arturovt merged 1 commit into
masterfrom
feat/error-dev-mode

Conversation

@arturovt
Copy link
Copy Markdown
Member

@arturovt arturovt commented May 7, 2026

In dev mode, selectSignal now logs a console.error when a selector returns a new object reference with the same JSON value as the previous result. This usually means the selector is missing memoization and is causing unnecessary downstream recomputations.

The check uses Object.is(a, b) to avoid warning for properly memoized selectors that already return the same reference.

The equal function still always returns false so recomputation continues to propagate normally, keeping the warning accurate for all state updates.

… reference with identical value

In dev mode, `selectSignal` now logs a `console.error` when a selector returns a
new object reference with the same JSON value as the previous result. This usually
means the selector is missing memoization and is causing unnecessary downstream
recomputations.

The check uses `Object.is(a, b)` to avoid warning for properly memoized selectors
that already return the same reference.

The `equal` function still always returns `false` so recomputation continues to
propagate normally, keeping the warning accurate for all state updates.
@arturovt arturovt force-pushed the feat/error-dev-mode branch from 1d2d551 to 563ea6e Compare May 7, 2026 20:13
@arturovt arturovt marked this pull request as ready for review May 7, 2026 20:13
@arturovt arturovt merged commit e3e5f6a into master May 7, 2026
4 of 5 checks passed
@arturovt arturovt deleted the feat/error-dev-mode branch May 7, 2026 20:13
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 7, 2026

View your CI Pipeline Execution ↗ for commit 563ea6e

Command Status Duration Result
nx run-many --target=test --all --configuration... ✅ Succeeded 1m 15s View ↗
nx run-many --target=lint --all --configuration... ✅ Succeeded 3s View ↗
nx lint-types store ✅ Succeeded <1s View ↗
nx run-many --target=build --all ✅ Succeeded 1m 11s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-07 20:19:56 UTC

@bundlemon
Copy link
Copy Markdown

bundlemon Bot commented May 7, 2026

BundleMon

Files updated (1)
Status Path Size Limits
fesm2022/ngxs-store.mjs
115.91KB (+748B +0.63%) 114KB / +0.5%
Unchanged files (5)
Status Path Size Limits
fesm2022/ngxs-store-operators.mjs
15.7KB 16KB / +0.5%
fesm2022/ngxs-store-internals.mjs
12.7KB 15KB / +0.5%
fesm2022/ngxs-store-internals-testing.mjs
10.32KB 13KB / +0.5%
fesm2022/ngxs-store-plugins.mjs
2.37KB 3KB / +0.5%
fesm2022/ngxs-store-experimental.mjs
574B 2KB / +0.5%

Total files change +748B +0.47%

Groups updated (1)
Status Path Size Limits
@ngxs/store(fesm2022)[gzip]
./fesm2022/*.mjs
39.47KB (+235B +0.58%) +1%

Final result: ❌

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@bundlemon
Copy link
Copy Markdown

bundlemon Bot commented May 7, 2026

BundleMon (NGXS Plugins)

Unchanged files (9)
Status Path Size Limits
Plugins(fesm2022)[gzip]
storage-plugin/fesm2022/ngxs-storage-plugin.m
js
4.12KB +0.5%
Plugins(fesm2022)[gzip]
router-plugin/fesm2022/ngxs-router-plugin.mjs
3.4KB +0.5%
Plugins(fesm2022)[gzip]
hmr-plugin/fesm2022/ngxs-hmr-plugin.mjs
2.78KB +0.5%
Plugins(fesm2022)[gzip]
websocket-plugin/fesm2022/ngxs-websocket-plug
in.mjs
2.58KB +0.5%
Plugins(fesm2022)[gzip]
form-plugin/fesm2022/ngxs-form-plugin.mjs
2.47KB +0.5%
Plugins(fesm2022)[gzip]
devtools-plugin/fesm2022/ngxs-devtools-plugin
.mjs
2.23KB +0.5%
Plugins(fesm2022)[gzip]
logger-plugin/fesm2022/ngxs-logger-plugin.mjs
2.03KB +0.5%
Plugins(fesm2022)[gzip]
storage-plugin/fesm2022/ngxs-storage-plugin-i
nternals.mjs
947B +0.5%
Plugins(fesm2022)[gzip]
router-plugin/fesm2022/ngxs-router-plugin-int
ernals.mjs
453B +0.5%

No change in files bundle size

Unchanged groups (1)
Status Path Size Limits
All Plugins(fesm2022)[gzip]
./-plugin/fesm2022/.mjs
20.96KB +0.5%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@bundlemon
Copy link
Copy Markdown

bundlemon Bot commented May 7, 2026

BundleMon (Integration Projects)

Files updated (1)
Status Path Size Limits
Main bundles(Gzip)
hello-world-ng21/dist-integration/browser/mai
n-(hash).js
67.88KB (-71B -0.1%) +1%

Total files change -71B -0.1%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

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