Skip to content

Remove lastRequestId on QueryInfo - #13320

Merged
jerelmiller merged 5 commits into
mainfrom
jerel/remove-last-request-id
Jul 13, 2026
Merged

Remove lastRequestId on QueryInfo#13320
jerelmiller merged 5 commits into
mainfrom
jerel/remove-last-request-id

Conversation

@jerelmiller

@jerelmiller jerelmiller commented Jul 9, 2026

Copy link
Copy Markdown
Member

Remove the lastRequestId property on QueryInfo. This stuck around from the v3 days where a QueryInfo instance was long-lived between requests. Now that a new QueryInfo instance is created for a single request, race conditions are no longer an issue. The condition checked in the error case requestId >= queryInfo.lastRequestId was always true since requestId is always equal to queryInfo.lastRequestId.

Summary by CodeRabbit

  • Bug Fixes
    • Improved request handling for network/query errors, reducing the chance of stale results affecting error recovery.
  • Chores
    • Updated the release to a patch version.
    • Removed unused internal cleanup code.

@changeset-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 513c98e

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

This PR includes changesets to release 1 package
Name Type
@apollo/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

@apollo-librarian

apollo-librarian Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: bca00823054bcc6f79c6d1ff
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.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 7db1cc5b-0b98-4dd2-9aa5-9045ad50fa16

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This change removes the unused lastRequestId field from QueryInfo and the corresponding generateRequestId mechanism from QueryManager. The error-handling logic in getResultsFromLink no longer gates the reset behavior on a request-id comparison, relying solely on the error policy check. A changeset documents the cleanup.

Changes

Request ID Cleanup

Layer / File(s) Summary
Remove request-id tracking and gating logic
src/core/QueryInfo.ts, src/core/QueryManager.ts, .changeset/hip-clocks-exercise.md
Removes the lastRequestId field from QueryInfo, removes generateRequestId and requestIdCounter from QueryManager, simplifies the errorPolicy === "none" check in getResultsFromLink to no longer depend on request-id comparison, and adds a patch changeset describing the cleanup.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: phryneas

Poem

A rabbit hopped through code so neat,
Found an old ID with no purpose to meet.
Snip went the field, snip went the check,
One less counter cluttering the deck! 🐇✂️
Now errors throw clean, no gate in the way—
Hop on, dear reviewer, it's a tidy day!

🚥 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 matches the main change: removing lastRequestId from QueryInfo.
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.

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.

@pkg-pr-new

pkg-pr-new Bot commented Jul 9, 2026

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

commit: 513c98e

@jerelmiller
jerelmiller requested a review from phryneas July 9, 2026 04:16
@jerelmiller
jerelmiller merged commit 538c906 into main Jul 13, 2026
50 checks passed
@jerelmiller
jerelmiller deleted the jerel/remove-last-request-id branch July 13, 2026 21:38
@github-actions github-actions Bot mentioned this pull request Jul 13, 2026
jerelmiller pushed a commit that referenced this pull request Jul 13, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @apollo/client@4.2.7

### Patch Changes

- [#13320](#13320)
[`538c906`](538c906)
Thanks [@jerelmiller](https://github.com/jerelmiller)! - Cleanup some
unused internals. Please file an issue if you notice anything change.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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