-
Notifications
You must be signed in to change notification settings - Fork 186
feat: Add collection/list serialization support with Component references #22366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Implemented server-to-client bean serialization with lazy Component resolution: - Server-side: Added BEAN_TYPE=5 to JacksonCodec with custom Component serializer * Components serialize as {"__vaadinType": "component", "nodeId": <id>} * Uses Jackson ObjectMapper with field visibility configuration * Handles nested beans and arrays automatically - Client-side: Added bean deserialization to ClientJsonCodec * Lazy component resolution - components are resolved when accessed * Native JavaScript function for component field access * Supports nested beans with component references - Tests: Comprehensive test coverage * 6 client-side unit tests for bean deserialization * 3 integration tests covering simple beans, nested beans, and component references * All tests passing successfully This enables sending complex Java beans with Component references from server to client via executeJs(), with automatic lazy resolution of components on the client side. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…adin Changed the special key used to identify Vaadin-specific types in JSON from "__vaadinType" to "@vaadin" to further avoid potential conflicts with user data. This applies to Component references in bean serialization. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…texts Changed single Component serialization to use the same format as Components within beans: - Single Components now serialize as [BEAN_TYPE, {"@vaadin": "component", "nodeId": <id>}] - This provides consistency between single Component serialization and Component fields within beans - Added BEAN_TYPE constant to JsonCodec for compatibility - Added test coverage for single Component serialization This unified format simplifies client-side handling and provides a consistent API for all Component serialization scenarios. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Removed NODE_TYPE constant from JsonCodec and JacksonCodec - Updated ClientJsonCodec to no longer handle NODE_TYPE format - Fixed ExecuteJavaScriptProcessorTest to use new component format - Updated decodeStateNode to handle new @vaadin component format - Fixed JacksonCodecTest to expect new component format - Added test for decodeStateNode with new component format - Fixed test assertions to match actual behavior - Clarified comment about GWT.isScript() check for compilation phase - All Component references now use: {"@vaadin": "component", "nodeId": <id>} 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Test Results1 007 files - 261 1 007 suites - 261 58m 16s ⏱️ - 18m 25s Results for commit 4d9632a. ± Comparison against base commit 236a649. This pull request removes 518 and adds 24 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
…nces - Add support for sending List, Set, and other Collections from server to client - Collections are encoded using existing ARRAY_TYPE format [1, arrayContent] - Enhanced client-side array decoding to support complex types (beans, components) - Arrays can now contain mixed types: primitives, beans, and component references - Component references use {"@vaadin": "component", "nodeId": <id>} format - Added comprehensive tests for list serialization scenarios - Integration tests verify end-to-end list/collection handling Technical changes: - JacksonCodec: Added Collection handling to encode as ARRAY_TYPE - ClientJsonCodec: Enhanced jsonArrayAsJsArray() to decode complex types - Added needsTypeDecoding() helper to identify values requiring type-aware decoding - Tests added for arrays with components, beans, and mixed types 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Technical changes: