Skip to content

Minor improvements#13299

Merged
jerelmiller merged 2 commits into
release-4.3from
jerel/short-circuit
Jun 30, 2026
Merged

Minor improvements#13299
jerelmiller merged 2 commits into
release-4.3from
jerel/short-circuit

Conversation

@jerelmiller

@jerelmiller jerelmiller commented Jun 30, 2026

Copy link
Copy Markdown
Member

Small improvements mentioned in #13270 (review).

  • Keeps cache.extract() cheap when no scalars are configured
  • Reuses an existing variable to remove unneeded duplicate code

Summary by CodeRabbit

  • Bug Fixes
    • Improved cache extraction so scalar values are only normalized when scalar handling is enabled.
    • Preserved stored values unchanged when scalar handling is disabled.
    • Refined store field checks to avoid redundant lookups during validation.

@apollo-librarian

apollo-librarian Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: c19c484512c393e71bd1902d
Build Logs: View logs


✅ AI Style Review — No Changes Detected

No MDX files were changed in this pull request.

Review Log: View detailed log

This review is AI-generated. Please use common sense when accepting these suggestions, as they may not always be accurate or appropriate for your specific context.

@changeset-bot

changeset-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0021dd9

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

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 90b58aa3-9c85-4420-9b6e-0bb751c26fc1

📥 Commits

Reviewing files that changed from the base of the PR and between aba0960 and 0021dd9.

📒 Files selected for processing (2)
  • src/cache/inmemory/entityStore.ts
  • src/cache/inmemory/readFromStore.ts
💤 Files with no reviewable changes (1)
  • src/cache/inmemory/readFromStore.ts

📝 Walkthrough

Walkthrough

EntityStore.extract() now conditionally coerces scalar values only when scalar configuration is enabled, via a new hasScalarConfig() helper also used in coerceStoreObject(). Separately, readFromStore's dev-mode scalar-policy warning reuses an existing typename variable instead of re-fetching it from the store.

Changes

Scalar Coercion Optimization

Layer / File(s) Summary
Conditional scalar coercion
src/cache/inmemory/entityStore.ts
Introduces hasScalarConfig() helper; extract() only rebuilds/coerces entries when scalar config exists, and coerceStoreObject()'s early-return condition now uses this helper.
Dev warning cleanup
src/cache/inmemory/readFromStore.ts
Removes redundant __typename re-fetch in the __DEV__ scalar-policy warning, reusing the existing typename variable from enclosing scope.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A scalar hopped, then paused to check,
"Is config here, or just a speck?"
If none's around, I skip the coerce,
Hopping lighter through the source.
Typename reused, no need to fetch—
This bunny's code is now less stretched. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too vague to convey the main change and reads like a generic placeholder. Use a specific title that mentions the cache extraction/scalar coercion change and the typename variable cleanup.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/cache/inmemory/entityStore.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


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.

@jerelmiller jerelmiller changed the title Jerel/short circuit Minor improvements Jun 30, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jun 30, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@apollo/client@13299

commit: 0021dd9

@jerelmiller jerelmiller merged commit 236631d into release-4.3 Jun 30, 2026
47 checks passed
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