Skip to content

Conversation

Artur-
Copy link
Member

@Artur- Artur- commented Sep 29, 2025

  • 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": } 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

Artur- and others added 6 commits September 29, 2025 17:37
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>
Copy link

github-actions bot commented Sep 29, 2025

Test Results

1 007 files   - 261  1 007 suites   - 261   58m 16s ⏱️ - 18m 25s
8 186 tests  - 494  8 144 ✅  - 469  42 💤  - 25  0 ❌ ±0 
8 619 runs   - 526  8 567 ✅  - 501  52 💤  - 25  0 ❌ ±0 

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.
com.vaadin.client.flow.util.ClientJsonCodecTest ‑ decodeStateNode_node
com.vaadin.client.flow.util.ClientJsonCodecTest ‑ decodeWithTypeInfo_element
com.vaadin.flow.AssertionTest ‑ testAssertionsAreEnabled
com.vaadin.flow.ClientResourceIT ‑ clientResourcesAreNotExposed[any_Chrome_]
com.vaadin.flow.FaultyLocationIT ‑ changeOnClient[any_Chrome_]
com.vaadin.flow.InitialExtendedClientDetailsIT ‑ verifyClientDetails[any_Chrome_]
com.vaadin.flow.InvalidLocationIT ‑ invalidCharactersOnPath_UiNotServed[any_Chrome_]
com.vaadin.flow.multiwar.deployment.TwoAppsIT ‑ bothWebComponentsEmbedded[any_Chrome_]
com.vaadin.flow.multiwar.deployment.TwoAppsIT ‑ testWar1Works[any_Chrome_]
com.vaadin.flow.multiwar.deployment.TwoAppsIT ‑ testWar2Works[any_Chrome_]
…
com.vaadin.client.flow.util.ClientJsonCodecTest ‑ decodeStateNode_bean
com.vaadin.client.flow.util.ClientJsonCodecTest ‑ decodeStateNode_directComponentReference
com.vaadin.client.flow.util.ClientJsonCodecTest ‑ decodeWithTypeInfo_arrayOfComponents
com.vaadin.client.flow.util.ClientJsonCodecTest ‑ decodeWithTypeInfo_arrayWithComplexTypes
com.vaadin.client.flow.util.ClientJsonCodecTest ‑ decodeWithTypeInfo_beanWithComponent
com.vaadin.client.flow.util.ClientJsonCodecTest ‑ decodeWithTypeInfo_beanWithComponentArray
com.vaadin.client.flow.util.ClientJsonCodecTest ‑ decodeWithTypeInfo_beanWithNullComponent
com.vaadin.client.flow.util.ClientJsonCodecTest ‑ decodeWithTypeInfo_beanWithUnattachedComponent
com.vaadin.client.flow.util.ClientJsonCodecTest ‑ decodeWithTypeInfo_directComponentReference
com.vaadin.client.flow.util.ClientJsonCodecTest ‑ decodeWithTypeInfo_directComponentReferenceWithNullNodeId
…

♻️ 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>
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants