[WIP] - partial view updates implementation#3209
Draft
aleksandr-gringauz wants to merge 38 commits intodevelopfrom
Draft
[WIP] - partial view updates implementation#3209aleksandr-gringauz wants to merge 38 commits intodevelopfrom
aleksandr-gringauz wants to merge 38 commits intodevelopfrom
Conversation
- Strip JSON serialization/deserialization and KDoc comments from RumViewState.kt - Remove explicit public modifiers - Add @Diff, @DiffMerge, @DiffAppend annotations to RumViewState fields - Fix DiffProcessor to handle nullable @DiffMerge types with null guard - Fix DiffProcessor to handle nullable @DiffAppend lists with orEmpty() - Fix APPEND field type to strip nullability in generated data classes - Add recursive @DiffMerge support in nested classes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace verbose `if (x.exists) x.item else null` pattern with `x.get()`, and add the `get()` method to `DiffOptional` to support this. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| * Copyright 2016-Present Datadog, Inc. | ||
| */ | ||
|
|
||
| @file:DiffConfig( |
Contributor
Author
There was a problem hiding this comment.
This is the configuration for the diff KSP. It describes that we need a diff function for ViewEvent (and its nested classes) and what strategies its different fields have.
ignore - it means that this field should always be present in a diff, even if it hasn't changed.
merge - corresponds to MERGE logic from the RFC.
append - APPEND logic for arrays.
diffMap - special case for feature flags (we include only new and changed values of the map of flags).
REPLACE strategy is the default one.
Here is the generated code to illustrate the idea: https://gist.github.com/aleksandr-gringauz/3e0c083be78b32323c436f633aa73ed4
It is pretty much what we are doing here by hand.
Contributor
Author
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.
What does this PR do?
PoC implementation of partial view updates.
The algorithm is roughly the following (see the diff in RumViewScope.kt). For each
ViewEventthat we create we:ViewEventDiffobject. In order to compute the diff of theViewEventrespecting REPLACE/MERGE/APPEND rules from the RFC I created a KSP processor that generates the diffing code based on a specialDiffConfigannotation. More info here.ViewEventDiffinto the newViewUpdateevent introduced here. See ViewEventDiffMapper.ViewUpdateevent to the intake.This PR doesn't address:
Motivation
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)