Skip to content

Conversation

@arnoud-dv
Copy link
Collaborator

@arnoud-dv arnoud-dv commented Oct 23, 2025

🎯 Changes

The signal returned by injectIsMutating should be read-only as it is not supposed to be changed outside the library.

βœ… Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

πŸš€ Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Refactor

    • The mutating signal used for mutation tracking is now exposed as read-only to prevent external modification.
  • Chores

    • Angular compiler strictness settings were tightened to improve type safety and template checks.
  • Documentation

    • Added a changeset entry recording a patch release and the read-only signal behavior.

@changeset-bot
Copy link

changeset-bot bot commented Oct 23, 2025

πŸ¦‹ Changeset detected

Latest commit: dd6278b

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

This PR includes changesets to release 2 packages
Name Type
@tanstack/angular-query-experimental Patch
@tanstack/angular-query-persist-client 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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 23, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

injectIsMutating now returns a readonly signal view (wrapped with asReadonly()). A changeset documents this patch. The package's tsconfig.json gained an angularCompilerOptions block enabling several strictness flags.

Changes

Cohort / File(s) Summary
Release Documentation
.changeset/inject-is-mutating-readonly.md
Added changeset documenting a patch release that notes injectIsMutating is now exposed read-only.
Signal Implementation
packages/angular-query-experimental/src/inject-is-mutating.ts
Return value wrapped with asReadonly() to expose a readonly signal view; internal mutation/subscription logic unchanged.
Compiler Configuration
packages/angular-query-experimental/tsconfig.json
Added angularCompilerOptions with enableI18nLegacyMessageIdFormat: false, strictInjectionParameters: true, strictInputAccessModifiers: true, strictStandalone: true, and strictTemplates: true.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Consumer as Component/Service
    participant API as injectIsMutating()
    participant Internal as Mutable Signal

    note over API,Internal #dff0d8: New behavior β€” API exposes readonly view

    Consumer->>API: call injectIsMutating()
    API->>Internal: obtain mutable signal
    API-->>Consumer: return asReadonly(Internal) (readonly view)
    Consumer->>API: read signal value
    API->>Internal: read current value
    note right of Internal: Internal may still be mutated by\ninternal query lifecycle (unchanged)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I wrapped my signal snug and tight,
asReadonly keeps it safe tonight,
A tiny changeset hops on through,
Strict flags awake β€” the code feels new,
Hooray for safer signals and a brighter view!

Pre-merge checks and finishing touches

βœ… Passed checks (3 passed)
Check name Status Explanation
Title Check βœ… Passed The pull request title "refactor(angular-query): make injectIsMutating signal read-only" directly and clearly summarizes the main change in the changeset. The title accurately reflects the primary modification, which wraps the injectIsMutating signal with asReadonly() to prevent external modifications. The title is concise, follows conventional commit format, and is specific enough that a teammate scanning the history would immediately understand the core purpose of the change.
Description Check βœ… Passed The pull request description follows the required template structure with all three main sections present: 🎯 Changes, βœ… Checklist, and πŸš€ Release Impact. The Changes section provides clear motivation explaining why the signal should be read-only. The Checklist section has both items completed (marked with [x]), and the Release Impact section correctly indicates that this affects published code with a changeset generated. All required information is provided, though the description remains appropriately concise.
Docstring Coverage βœ… Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

πŸ“œ Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 9bfee6e and dd6278b.

πŸ“’ Files selected for processing (3)
  • .changeset/inject-is-mutating-readonly.md (1 hunks)
  • packages/angular-query-experimental/src/inject-is-mutating.ts (2 hunks)
  • packages/angular-query-experimental/tsconfig.json (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Oct 23, 2025

View your CI Pipeline Execution β†— for commit dd6278b

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... βœ… Succeeded 2m 9s View β†—
nx run-many --target=build --exclude=examples/*... βœ… Succeeded 7s View β†—

☁️ Nx Cloud last updated this comment at 2025-10-23 12:54:42 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 23, 2025

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@9801

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@9801

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@9801

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@9801

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@9801

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@9801

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@9801

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@9801

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@9801

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@9801

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@9801

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@9801

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@9801

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@9801

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@9801

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@9801

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@9801

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@9801

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@9801

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@9801

commit: 9bfee6e

@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 94.13%. Comparing base (27df987) to head (dd6278b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #9801       +/-   ##
===========================================
+ Coverage   45.74%   94.13%   +48.39%     
===========================================
  Files         200       21      -179     
  Lines        8404      426     -7978     
  Branches     1920       99     -1821     
===========================================
- Hits         3844      401     -3443     
+ Misses       4112       24     -4088     
+ Partials      448        1      -447     
Components Coverage Ξ”
@tanstack/angular-query-experimental 93.85% <100.00%> (ΓΈ)
@tanstack/eslint-plugin-query βˆ… <ΓΈ> (βˆ…)
@tanstack/query-async-storage-persister βˆ… <ΓΈ> (βˆ…)
@tanstack/query-broadcast-client-experimental βˆ… <ΓΈ> (βˆ…)
@tanstack/query-codemods βˆ… <ΓΈ> (βˆ…)
@tanstack/query-core βˆ… <ΓΈ> (βˆ…)
@tanstack/query-devtools βˆ… <ΓΈ> (βˆ…)
@tanstack/query-persist-client-core βˆ… <ΓΈ> (βˆ…)
@tanstack/query-sync-storage-persister βˆ… <ΓΈ> (βˆ…)
@tanstack/query-test-utils βˆ… <ΓΈ> (βˆ…)
@tanstack/react-query βˆ… <ΓΈ> (βˆ…)
@tanstack/react-query-devtools βˆ… <ΓΈ> (βˆ…)
@tanstack/react-query-next-experimental βˆ… <ΓΈ> (βˆ…)
@tanstack/react-query-persist-client βˆ… <ΓΈ> (βˆ…)
@tanstack/solid-query βˆ… <ΓΈ> (βˆ…)
@tanstack/solid-query-devtools βˆ… <ΓΈ> (βˆ…)
@tanstack/solid-query-persist-client βˆ… <ΓΈ> (βˆ…)
@tanstack/svelte-query βˆ… <ΓΈ> (βˆ…)
@tanstack/svelte-query-devtools βˆ… <ΓΈ> (βˆ…)
@tanstack/svelte-query-persist-client βˆ… <ΓΈ> (βˆ…)
@tanstack/vue-query βˆ… <ΓΈ> (βˆ…)
@tanstack/vue-query-devtools βˆ… <ΓΈ> (βˆ…)
πŸš€ 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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/angular-query-experimental/src/inject-is-mutating.ts (1)

22-29: Consider updating JSDoc to document read-only return value.

The JSDoc should mention that the returned signal is read-only to help consumers understand the API contract.

Apply this diff to update the JSDoc:

 /**
  * Injects a signal that tracks the number of mutations that your application is fetching.
  *
  * Can be used for app-wide loading indicators
  * @param filters - The filters to apply to the query.
  * @param options - Additional configuration
- * @returns signal with number of fetching mutations.
+ * @returns A read-only signal with the number of fetching mutations.
  */
πŸ“œ Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 27df987 and 9bfee6e.

πŸ“’ Files selected for processing (3)
  • .changeset/inject-is-mutating-readonly.md (1 hunks)
  • packages/angular-query-experimental/src/inject-is-mutating.ts (1 hunks)
  • packages/angular-query-experimental/tsconfig.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test
  • GitHub Check: Preview
πŸ”‡ Additional comments (3)
.changeset/inject-is-mutating-readonly.md (1)

1-5: LGTM! Changeset accurately documents the change.

The changeset correctly identifies this as a patch release and clearly describes the motivation for making the signal read-only.

packages/angular-query-experimental/src/inject-is-mutating.ts (1)

63-63: LGTM! Proper encapsulation of mutable internal state.

The use of asReadonly() correctly returns a readonly view to external consumers while preserving the internal mutable signal for updates. This prevents accidental external modifications to the mutation count state.

packages/angular-query-experimental/tsconfig.json (1)

10-16: <!-- [scratchpad_start]
[task verification_strictness_options 2/2]
git diff returned empty output. Need alternative approach to identify what changed in this PR.

[observations]

  • git diff HEAD produced no output for tsconfig.json
  • This suggests either: (1) changes not committed, (2) on main branch, or (3) HEAD is the current state
  • Review snippet shows the FINAL state (lines 10-16): Angular compiler options with strictInjectionParameters, strictInputAccessModifiers, strictStandalone, strictTemplates set to true
  • Build failed with TypeScript errors (not Angular compiler errors)
  • Strictness options shown are in angularCompilerOptions block, not TypeScript compilerOptions

[analysis]

  • Review comment focuses on Angular strictness options, but errors are TypeScript compile errors
  • Need to determine: are these options NEW in this PR, or were they already there?
  • Need to check git log or PR diff to see what actually changed

[pending]

  • Check git log to see recent changes to this file
  • Or check if there's a PR base branch to compare against
  • Or directly view tsconfig.json to see all options

[actions]
Try git log to see recent commits, or check git status and branches to understand context

@arnoud-dv arnoud-dv force-pushed the refactor/inject-is-mutating-readonly-signal branch from 9bfee6e to dd6278b Compare October 23, 2025 12:51
@arnoud-dv arnoud-dv merged commit 907087f into TanStack:main Oct 23, 2025
5 of 6 checks passed
@arnoud-dv arnoud-dv deleted the refactor/inject-is-mutating-readonly-signal branch October 23, 2025 12:52
@github-actions github-actions bot mentioned this pull request Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant