fix(tanstack-query): support DbNull/JsonNull/AnyNull serialization over the wire#2630
Conversation
…er the wire Register SuperJSON custom serializers for the three JSON null sentinels in both the client-helpers fetch layer and the server's registerCustomSerializers, so they survive HTTP round-trips when used as query filters or mutation input. Re-export the singletons from all tanstack-query framework entry points (react, vue, svelte) for convenient user access. Fixes #2278 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughSuperJSON custom serializers are registered for Zenstack ORM null wrapper classes ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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. Review rate limit: 6/8 reviews remaining, refill in 8 minutes and 8 seconds.Comment |
|
Claude finished @ymc9's task —— View job PR Review: JSON Null Serialization SupportI'll review this PR and provide feedback on code quality, potential bugs, performance, security, and test coverage. Review Tasks:
Analysis SummaryThis PR implements SuperJSON serialization support for ZenStack's null sentinels ( Code Quality Assessment✅ Strengths
🔍 Areas for Improvement
Technical AnalysisSerialization Implementation (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/clients/tanstack-query/test/react-query.test.tsx`:
- Around line 1896-1903: The test is constructing a fake sentinel ({ __brand:
'DbNull' }) which bypasses the registered serializer; instead instantiate and
use the real sentinel class (DbNullClass) so the serializer path is executed:
change the mutation and any response assertions to pass new DbNullClass() (or
the exported real instance) into result.current.mutate and into expected
response bodies, and ensure the test imports/uses DbNullClass and still calls
deserialize(capturedBody.data, capturedBody.meta.serialization) to assert
reconstructed.data.name.__brand === 'DbNull'.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6c474b8a-a30a-4cef-9f15-a312c37ef3b6
📒 Files selected for processing (9)
packages/clients/client-helpers/src/fetch.tspackages/clients/client-helpers/src/index.tspackages/clients/tanstack-query/src/react.tspackages/clients/tanstack-query/src/svelte/index.svelte.tspackages/clients/tanstack-query/src/vue.tspackages/clients/tanstack-query/test/react-query.test.tsxpackages/orm/package.jsonpackages/orm/tsdown.config.tspackages/server/src/api/utils.ts
|
Claude finished @ymc9's task —— View job PR Review: JSON Null Serialization SupportI'll review this PR and provide feedback on code quality, potential bugs, performance, security, and test coverage. Review Tasks:
Analysis SummaryThis PR implements SuperJSON serialization support for ZenStack's null sentinels ( Code Quality Assessment✅ Strengths
🔍 Areas for Improvement
Technical AnalysisSerialization Implementation (
|
Summary
DbNull,JsonNull, andAnyNullin@zenstackhq/client-helpersfetch layer, so these sentinels survive HTTP round-trips when passed as query filters or mutation input from tanstack-query hooksregisterCustomSerializers()so the server can correctly deserialize them back to ORM sentinel instancesDbNull,JsonNull,AnyNullfrom all tanstack-query framework entry points (react,vue,svelte) for convenient user accessTest plan
packages/clients/tanstack-query/test/react-query.test.tsxcovering all three sentinels in query filters (URL includes SuperJSON metadata) and mutation bodies, plus response deserializationpnpm testinpackages/clients/tanstack-query— all 52 tests passpnpm testinpackages/clients/client-helpersFixes #2278
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests