fix(db): preserve explicit gcTime of 0 on live query collections#1660
Open
spokodev wants to merge 1 commit into
Open
fix(db): preserve explicit gcTime of 0 on live query collections#1660spokodev wants to merge 1 commit into
spokodev wants to merge 1 commit into
Conversation
The live query config builder used `this.config.gcTime || 5000`, which treats an explicit `gcTime: 0` (disable GC) as unset and replaces it with the 5s default. The collection is then garbage collected instead of being kept alive. Use `??` so only `undefined` falls back to the default.
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR fixes a bug in ChangesgcTime Default Fix
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The live query config builder built its collection options with
gcTime: this.config.gcTime || 5000. AgcTimeof0disables garbage collection (the core lifecycle treatsgcTime <= 0as "never GC"), but0 || 5000evaluates to5000, so an explicitgcTime: 0on a live query collection is silently replaced by the 5s default and the collection is garbage collected 5s after its last subscriber unsubscribes.Use
??so onlyundefinedfalls back to the default; an explicit0is forwarded and GC is disabled as documented.Repro:
liveQueryCollectionOptions({ query, gcTime: 0 }).gcTimereturns5000instead of0. Added a regression test.Summary by CodeRabbit
gcTime: 0is preserved instead of being replaced with the default timeout.gcTime: 0continues to work correctly.