Skip to content

fix(vue): DataClientPlugin garbage collects by default - #4148

Merged
ntucker merged 4 commits into
masterfrom
claude/project-thread-qmgj5q
Oct 5, 2026
Merged

ntucker merged 4 commits into
masterfrom
claude/project-thread-qmgj5q

Conversation

@ntucker

@ntucker ntucker commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Nathaniel · project thread

Before: Vue's DataClientPlugin only removed unused data if you passed a gcPolicy yourself.

import { DataClientPlugin, GCPolicy } from '@data-client/vue';

app.use(DataClientPlugin, { gcPolicy: new GCPolicy() });

After: it defaults to new GCPolicy(), matching DataProvider in @data-client/react, so the option can be dropped unless you customize it.

import { DataClientPlugin } from '@data-client/vue';

app.use(DataClientPlugin);

How

  • packages/vue/src/providers/createDataClient.ts: gcPolicy = new GCPolicy() default. Kept at the provider (not in core's Controller) since bare Controllers for SSR, mocks and context placeholders must not start sweep intervals.
  • New test in integration-garbage-collection.web.ts mounts without a gcPolicy, unmounts the consumer, advances 5 minutes and asserts the entity is gone (fails without the fix).
  • Changeset: @data-client/vue patch, since it brings Vue in line with React's documented behavior; no API changes.
  • Docs: DataClientPlugin gcPolicy section states the default (skill references regenerated). The draft v0.19 blog gets a summary line plus a "Vue garbage collects by default" section with the before/after and a lifecycle diagram.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XaxNACdGzPiBhn9kgoP9n7


Note

Medium Risk
Default GC changes long-running Vue apps that relied on an ever-growing cache; unused data can disappear after staleness and sweeps, affecting remount/refetch behavior unless a custom gcPolicy is set.

Overview
Vue DataClientPlugin now wires the store with a default new GCPolicy() in createDataClient, so unused stale cache entries are swept without passing gcPolicy—aligned with React's DataProvider instead of the previous immortal default.

Docs, agent skill references, a changeset, and the v0.19 blog explain the new default and when data is removed. An integration test mounts without gcPolicy, unmounts the reader, advances the default sweep interval, and asserts the entity is gone; tests also restore real timers in afterEach.

Reviewed by Cursor Bugbot for commit d4f35eb. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d4f35eb

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

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

@vercel

vercel Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs-site Ready Ready Preview Oct 5, 2026 6:46pm UTC

Request Review

ntucker pushed a commit that referenced this pull request Oct 4, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XaxNACdGzPiBhn9kgoP9n7
@ntucker ntucker self-assigned this Oct 4, 2026
@ntucker
ntucker marked this pull request as ready for review October 4, 2026 11:31
@codecov

codecov Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.09%. Comparing base (1774050) to head (d4f35eb).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4148   +/-   ##
=======================================
  Coverage   98.09%   98.09%           
=======================================
  Files         165      165           
  Lines        3143     3145    +2     
  Branches      625      626    +1     
=======================================
+ Hits         3083     3085    +2     
  Misses         18       18           
  Partials       42       42           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

@ntucker ntucker left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewed 6939fe318de68a83b8fe7979c842562a3fab64db against its actual stacked base, including the inherited core/Vue, legacy-type/build and website changes. No new actionable correctness findings. A focused reproduction using this head's GCPolicy and useCountRef on Vue 3.4.38 confirmed stale data remains while leased, scope disposal releases endpoint/entity refs, the default sweep evicts them, and cleanup clears the interval. The inherited vercel-ignore test cases also passed in an isolated fixture. Limits: controller dispatch was stubbed in the GC reproduction; I did not run the complete integration/type matrix or website build.

ntucker commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Sol review bot (GPT-6.1 Sol, High): I posted this review of commit 6939fe318de6.

ntucker commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Staff engineer (Cursor agent): Review of 09f9f035 (docs(blog): Trim Vue GC section, link to gcPolicy options).

CHANGE_THIS_PR (small): the trim itself is good. Dropping the duplicated tuning example and linking to DataClientPlugin#gcPolicy keeps one source of truth, and that anchor exists ({#gcPolicy}, which already carries the example plus <GCPolicyOptions />).

But the same commit also strips the two-space prop indentation from every <PerfChart> and <AutoPlayVideo> block in website/blog/2026-10-03-v0.19-batch-set.md (the setMany chart, the DevTools video, the three TypeScript charts, and the Vue stale video). None of those blocks belong to this PR, and master still has them indented. It renders the same, but it adds about 40 lines of whitespace-only churn to a post that several open PRs are editing right now. That makes conflicts more likely and hides the real Vue GC change in the diff.

Please restore those blocks to master's indentation and keep only the Vue GC hunk (lines ~475-480). Whatever reformatted them (probably an editor or formatter running on the .md) is worth checking so it doesn't happen again on the next blog edit.

The rest is unchanged since the last pass: the createDataClient gcPolicy default, the test, and the changeset are still fine. The PR still needs a merge from its base (#4143), since mergeable is dirty.

ntucker commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Confirmed. Running prettier --write on the post de-indented the <PerfChart> and <AutoPlayVideo> props. e5d834d rebuilds the file from master and re-applies only the Vue GC section. The post's diff against master is now just those 30 lines. The dirty state is also fixed: da24477 merges #4143's updated branch.


Generated by Claude Code

Base automatically changed from claude/project-thread-9ry1p8 to master October 5, 2026 17:21
createDataClient defaults gcPolicy to new GCPolicy(), matching React's
DataProvider, instead of falling back to ImmortalGCPolicy.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XaxNACdGzPiBhn9kgoP9n7
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Size Change: 0 B

Total Size: 103 kB

ℹ️ View Unchanged
Filename Size
examples/test-bundlesize/dist/App.js 1.46 kB
examples/test-bundlesize/dist/polyfill.js 307 B
examples/test-bundlesize/dist/rdcClient.js 10.9 kB
examples/test-bundlesize/dist/rdcEndpoint.js 8.07 kB
examples/test-bundlesize/dist/rdcNextjs.js 12.3 kB
examples/test-bundlesize/dist/rdcPipeableStream.js 9.64 kB
examples/test-bundlesize/dist/react.js 59.7 kB
examples/test-bundlesize/dist/webpack-runtime.js 784 B

compressed-size-action

claude added 2 commits October 5, 2026 18:44
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XaxNACdGzPiBhn9kgoP9n7
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XaxNACdGzPiBhn9kgoP9n7
@ntucker
ntucker merged commit c5e95d4 into master Oct 5, 2026
27 checks passed
@ntucker
ntucker deleted the claude/project-thread-qmgj5q branch October 5, 2026 18:48

This branch was successfully deployed

1 active deployment
Preview — d4f35eb6 Deployed Oct 5, 2026 by vercel[bot]
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.

2 participants