Skip to content

[refactor!]: changed resultObservable deep -> ref globally#79

Open
js2me wants to merge 2 commits intomasterfrom
refactor/deep-to-ref-result-observable-globally
Open

[refactor!]: changed resultObservable deep -> ref globally#79
js2me wants to merge 2 commits intomasterfrom
refactor/deep-to-ref-result-observable-globally

Conversation

@js2me
Copy link
Copy Markdown
Owner

@js2me js2me commented Apr 29, 2026

Summary by CodeRabbit

  • Breaking Changes

    • Default observable tracking for Query and Mutation results changed to reference-only mode. Applications requiring deep tracking of nested fields must explicitly set resultObservable: 'deep'.
  • Documentation

    • Updated Query and Mutation API documentation to reflect the new default observable tracking behavior.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

Warning

Rate limit exceeded

@js2me has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 39 minutes and 56 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5d7728fb-6ccd-4782-b2d8-53e286d7ed56

📥 Commits

Reviewing files that changed from the base of the PR and between a2dac5c and 9e8721b.

📒 Files selected for processing (1)
  • src/query.test.ts
📝 Walkthrough

Walkthrough

The default value for resultObservable is changed from 'deep' to 'ref' across the mobx-tanstack-query library. This is a breaking change marked as a major version bump. By default, MobX now tracks only result object references instead of deep property changes. Tests and documentation are updated to reflect this new default behavior.

Changes

Cohort / File(s) Summary
Changesets & Documentation
.changeset/friendly-mails-cheat.md, docs/api/Query.md, docs/api/Mutation.md
Major version bump documented with changesets file; API documentation updated to reflect observable.ref as default instead of observable.deep, with configuration guidance for users requiring deep tracking.
Implementation Defaults
src/base-query.ts, src/mutation.ts
Default resultObservable value changed from 'deep' to 'ref' in feature merging logic.
Type Documentation
src/query.types.ts, src/mutation.types.ts
JSDoc @default tags and enum descriptions updated to document 'ref' as the default observable mode when option is omitted.
Test Assertions
src/query.test.ts, src/infinite-query.test.ts, src/mutation.test.ts
Test expectations updated from isProxy(true) to isProxy(false) to reflect that internal results are no longer MobX proxies by default.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 From deep to ref, a choice we make,
Less magic now, less tracking's weight,
Plain references hop along so free,
Yet deep is there, if you request it, see?
A breaking change, but oh so clean! 🥕✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: switching the default resultObservable from 'deep' to 'ref' globally across the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/deep-to-ref-result-observable-globally

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
Review rate limit: 0/1 reviews remaining, refill in 39 minutes and 56 seconds.

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

@js2me js2me changed the title refactor!: changed resultObservable deep -> ref globally [refactor!]: changed resultObservable deep -> ref globally Apr 29, 2026
Copy link
Copy Markdown

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/base-query.ts`:
- Around line 135-137: The change to default resultObservable to 'ref' breaks
existing deep-mutation behavior; revert the defaulting logic so resultObservable
preserves previous behavior (use 'deep' unless explicitly overridden) by
adjusting the assignment that sets resultObservable (currently using
config.resultObservable ?? qf?.resultObservable ?? 'ref') to prefer 'deep' as
the fallback (or preserve qf/config if present) so nested in-place mutations
continue to trigger reactions; update the initialization in the
function/constructor where resultObservable is set (look for the
resultObservable, config, and qf symbols) to return 'deep' when no explicit
option is provided.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 83219d60-a55a-4412-af27-78272036a647

📥 Commits

Reviewing files that changed from the base of the PR and between a454dbf and a2dac5c.

📒 Files selected for processing (10)
  • .changeset/friendly-mails-cheat.md
  • docs/api/Mutation.md
  • docs/api/Query.md
  • src/base-query.ts
  • src/infinite-query.test.ts
  • src/mutation.test.ts
  • src/mutation.ts
  • src/mutation.types.ts
  • src/query.test.ts
  • src/query.types.ts

Comment thread src/base-query.ts
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