-
Notifications
You must be signed in to change notification settings - Fork 5
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
Change TreeTextNode to value class #190
Conversation
WalkthroughThe changes encompass various updates and refactorings across multiple files. Key updates include version upgrades for Kotlin, Android Gradle Plugin, and AndroidX libraries. Additionally, there are significant refactorings in Changes
Sequence Diagram(s) (Beta)No sequence diagrams necessary for the provided changes. Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- build.gradle.kts (1 hunks)
- gradle/libs.versions.toml (2 hunks)
- yorkie/src/main/kotlin/dev/yorkie/document/crdt/TreeInfo.kt (3 hunks)
- yorkie/src/main/kotlin/dev/yorkie/document/json/JsonTree.kt (1 hunks)
Files skipped from review due to trivial changes (1)
- build.gradle.kts
Additional comments not posted (6)
yorkie/src/main/kotlin/dev/yorkie/document/crdt/TreeInfo.kt (2)
12-13
: The transformation ofTreeNode
into an interface is well-executed and aligns with modern Kotlin practices.
51-55
: Conversion ofTreeTextNode
to a value class is a great use of Kotlin features to optimize memory usage, especially for large texts.gradle/libs.versions.toml (3)
5-5
: Update of Android Gradle Plugin to version 8.4.1 is noted and appropriate.
10-12
: Updates toandroidxLifecycle
andandroidxComposeCompiler
are minor and likely include improvements or bug fixes.
28-28
: Update ofandroidx-appcompat
to version 1.7.0 is noted. Please ensure compatibility with other AndroidX libraries.Verification successful
The search results indicate that
androidx.appcompat
is used in several files, specificallyYorkieEditText.kt
andMainActivity.kt
. There are no immediate signs of deprecated methods or classes related toandroidx.appcompat
in these files. The deprecated annotations found are in a different context (TreeBuilder.kt
), which does not seem related toandroidx.appcompat
.Given this information, it appears that the update to
androidx-appcompat
version 1.7.0 does not introduce any immediate compatibility issues with the current codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify compatibility of androidx-appcompat with other AndroidX libraries. # Test: Search for compatibility issues in the project documentation and issue tracker. gh issue list --search "androidx-appcompat 1.7.0 compatibility"Length of output: 65
Script:
#!/bin/bash # Description: Search for usages of androidx-appcompat in the codebase and check for potential issues. # Find all files that import androidx.appcompat and list the lines where it's used. rg --glob '*.java' --glob '*.kt' 'androidx.appcompat' --context 5 # Check for deprecated methods or classes in the codebase. rg --glob '*.java' --glob '*.kt' '@Deprecated' --context 5Length of output: 4677
yorkie/src/main/kotlin/dev/yorkie/document/json/JsonTree.kt (1)
173-180
: The refactoring of theeditInternal
method to handleTextNode
instances differently is a significant improvement. Ensure this is covered by unit tests to verify the new behavior.
val textNodes = contents.filterIsInstance<TextNode>() | ||
val compVal = if (textNodes.size == 1) { | ||
textNodes.single().value | ||
} else { | ||
textNodes.joinTo(StringBuilder(textNodes.sumOf { it.value.length }), "") { | ||
it.value | ||
}.toString() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default joinToString
for large text can result in multiple resizings of the list,
so I changed to joinTo
with initial size that matched the text length.
I'll check on failing The test is working fine on the real server. |
What this PR does / why we need it?
Change TreeTextNode to value class.
This can help reduce memory usage, especially for large text.
Any background context you want to provide?
What are the relevant tickets?
Fixes #
Checklist
Summary by CodeRabbit