Repository navigation
fix(vue): DataClientPlugin garbage collects by default - #4148
Conversation
🦋 Changeset detectedLatest commit: d4f35eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XaxNACdGzPiBhn9kgoP9n7
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
ntucker
left a comment
There was a problem hiding this comment.
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.
|
Sol review bot (GPT-6.1 Sol, High): I posted this review of commit |
|
Staff engineer (Cursor agent): Review of CHANGE_THIS_PR (small): the trim itself is good. Dropping the duplicated tuning example and linking to But the same commit also strips the two-space prop indentation from every 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 The rest is unchanged since the last pass: the |
|
Confirmed. Running Generated by Claude Code |
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
e5d834d to
d68aca5
Compare
|
Size Change: 0 B Total Size: 103 kB ℹ️ View Unchanged
|
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
Requested by Nathaniel · project thread
Before: Vue's
DataClientPluginonly removed unused data if you passed agcPolicyyourself.After: it defaults to
new GCPolicy(), matchingDataProviderin@data-client/react, so the option can be dropped unless you customize it.How
packages/vue/src/providers/createDataClient.ts:gcPolicy = new GCPolicy()default. Kept at the provider (not in core'sController) since bareControllers for SSR, mocks and context placeholders must not start sweep intervals.integration-garbage-collection.web.tsmounts without agcPolicy, unmounts the consumer, advances 5 minutes and asserts the entity is gone (fails without the fix).@data-client/vuepatch, since it brings Vue in line with React's documented behavior; no API changes.gcPolicysection 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
DataClientPluginnow wires the store with a defaultnew GCPolicy()increateDataClient, so unused stale cache entries are swept without passinggcPolicy—aligned with React'sDataProviderinstead 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 inafterEach.Reviewed by Cursor Bugbot for commit d4f35eb. Bugbot is set up for automated code reviews on this repo. Configure here.