Skip to content
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

Updated Essenty to 2.2.0 and Compose to 1.7.0 #801

Merged
merged 1 commit into from
Oct 23, 2024

Conversation

arkivanov
Copy link
Owner

@arkivanov arkivanov commented Oct 22, 2024

Summary by CodeRabbit

  • New Features

    • Updated dependencies to their latest stable versions for improved performance and stability.
  • Bug Fixes

    • Enhanced instance management in the DefaultCounterComponent and DefaultKittenComponent, improving state retention across configuration changes.

These updates ensure a more reliable user experience with better state management and the latest features from dependencies.

Copy link

coderabbitai bot commented Oct 22, 2024

Walkthrough

The pull request includes updates to the deps.versions.toml file, changing the versions of the essenty and jetbrainsCompose dependencies from beta and release candidate versions to stable releases. Additionally, modifications were made to the DefaultCounterComponent and DefaultKittenComponent classes, where the getOrCreate method was replaced with the retainedInstance method from the InstanceKeeper class. This change affects how instances are managed and retained across configuration changes, while the overall structure and public interfaces of the components remain unchanged.

Changes

File Change Summary
deps.versions.toml Updated essenty from "2.2.0-beta01" to "2.2.0" and jetbrainsCompose from "1.7.0-rc01" to "1.7.0".
sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/counters/counter/DefaultCounterComponent.kt Replaced getOrCreate method with retainedInstance for handler instance management.
sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/customnavigation/DefaultKittenComponent.kt Replaced getOrCreate method with retainedInstance for handler instance management.

Possibly related PRs

  • Updated Compose to 1.7.0-rc01 #790: The changes in this PR involve updates to the jetbrainsCompose dependency in the deps.versions.toml file, which is directly related to the version updates made in the main PR for the same dependency.

Poem

🐰 In the garden of code, we hop with glee,
Versions updated, as fresh as can be!
With handlers retained, our state stays bright,
Through changes and tweaks, we code with delight!
So let’s celebrate, with a joyful cheer,
For stable releases, we hold so dear! 🌼


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@arkivanov arkivanov force-pushed the update-essenty-and-compose branch from 520a3aa to 713126d Compare October 22, 2024 22:34
Copy link

@coderabbitai coderabbitai bot left a 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

🧹 Outside diff range and nitpick comments (1)
sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/customnavigation/DefaultKittenComponent.kt (1)

24-28: Migration to retainedInstance looks good

The migration from getOrCreate to retainedInstance is implemented correctly, maintaining proper state initialization and lifecycle management. Consider adding a comment explaining the instance retention behavior for future maintainers.

    private val handler =
+       // Retained instance survives configuration changes but is destroyed with the component
        retainedInstance {
            Handler(initialState = stateKeeper.consume(key = KEY_STATE, strategy = State.serializer()) ?: State())
        }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6dcca39 and 713126d.

📒 Files selected for processing (3)
  • deps.versions.toml (1 hunks)
  • sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/counters/counter/DefaultCounterComponent.kt (2 hunks)
  • sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/customnavigation/DefaultKittenComponent.kt (2 hunks)
🧰 Additional context used
🔇 Additional comments (7)
sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/customnavigation/DefaultKittenComponent.kt (2)

9-9: LGTM: Correct import for Essenty 2.2.0

The import of retainedInstance is the correct replacement for the deprecated getOrCreate method in Essenty 2.2.0.


24-28: Verify complete migration from getOrCreate

Let's ensure all instances of getOrCreate have been migrated to retainedInstance across the codebase.

✅ Verification successful

Based on the search results, I can now generate the final response:

Migration from getOrCreate to retainedInstance is correctly scoped

The remaining instances of getOrCreate are legitimate as they are:

  • Internal framework code in the decompose library itself
  • Test files validating instance retention behavior
  • Documentation examples showing both old and new usage

The sample application code has been properly migrated to use retainedInstance, as evidenced by its usage in:

  • DefaultKittenComponent
  • DefaultCardComponent
  • DefaultCounterComponent
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining usage of getOrCreate method
# Expected: No results, indicating complete migration

# Search for any remaining getOrCreate usage
echo "Checking for remaining getOrCreate usage:"
rg "getOrCreate"

# Search for new retainedInstance usage to verify migration
echo -e "\nVerifying retainedInstance migration:"
rg "retainedInstance"

Length of output: 22649

sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/counters/counter/DefaultCounterComponent.kt (2)

14-14: LGTM: Import updated for Essenty 2.2.0

The new import reflects the updated API in Essenty 2.2.0.


Line range hint 34-39: LGTM: Successfully migrated to retainedInstance

The migration from getOrCreate to retainedInstance is correct and maintains the same functionality for instance retention and state management.

Let's verify this migration pattern is consistently applied across the codebase:

✅ Verification successful

Based on the search results, I can generate the final response as I have enough information to verify the migration pattern.

Migration from getOrCreate to retainedInstance is correctly applied in production code

The search results show that all remaining uses of getOrCreate are in:

  • Test files (*Test.kt)
  • Documentation files (*.md)
  • Internal implementation details of the framework

The production code in the sample application has successfully migrated to using retainedInstance, as evidenced by its usage in:

  • DefaultCounterComponent.kt
  • DefaultKittenComponent.kt
  • DefaultCardComponent.kt
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the migration from getOrCreate to retainedInstance
# Expected: No remaining uses of getOrCreate and consistent use of retainedInstance

# Check for any remaining uses of getOrCreate
echo "Checking for remaining uses of getOrCreate..."
rg "getOrCreate"

# Verify the adoption of retainedInstance
echo "Verifying adoption of retainedInstance..."
rg "retainedInstance"

Length of output: 22659

deps.versions.toml (3)

5-8: Verify compatibility between updated dependencies.

Both Essenty and Compose updates look good individually. Since they interact in your component lifecycle management, let's verify their compatibility.

#!/bin/bash
# Description: Check for any known compatibility issues between these versions
# Look for imports/usage patterns that might indicate version conflicts
echo "Checking for potential compatibility issues..."
rg -l "import.*essenty.*lifecycle.*import.*compose" || echo "No direct interaction found"

8-8: Verified: Update to stable Compose version looks good.

The upgrade from RC to stable version (1.7.0) is appropriate. This aligns with good practice of using stable releases in production code.

Let's verify this is the latest stable version and check compatibility:

#!/bin/bash
# Description: Check latest Compose version and verify compatibility
echo "Checking latest Compose version..."
curl -s https://repo1.maven.org/maven2/org/jetbrains/compose/compose-gradle-plugin/maven-metadata.xml | grep -oP '<latest>\K[^<]+'

echo "Checking Kotlin compatibility..."
# Verify Kotlin version compatibility with Compose
rg "kotlin.*=.*\"2.0.20\"" -A 5

5-5: Verified: Update to stable Essenty version looks good.

The upgrade from beta to stable version (2.2.0) is a positive change. This version is particularly important as it provides the retainedInstance functionality being used in the component changes.

Let's verify this is the latest stable version:

✅ Verification successful

Let me generate another verification script to specifically check the Essenty version since the previous output seems to have mixed results from different checks.

This will help us get a clearer picture of the latest available Essenty versions from Maven Central.


Let me try one final verification approach using a different Maven repository API endpoint:

This should list the available versions directly from Maven Central's directory structure.


✅ Essenty version 2.2.0 is the latest stable release

The verification confirms that version 2.2.0 is indeed the latest stable release of Essenty, following the alpha and beta releases in the 2.2.0 series. The upgrade from 2.2.0-beta01 to 2.2.0 in the PR is appropriate and represents the most current stable version available.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check latest Essenty version from Maven Central
curl -s https://repo1.maven.org/maven2/com/arkivanov/essenty/lifecycle/maven-metadata.xml | grep -oP '<latest>\K[^<]+'

Length of output: 579


Script:

#!/bin/bash
# Let's specifically check Essenty versions
echo "Checking Essenty versions..."
curl -s "https://search.maven.org/solrsearch/select?q=g:com.arkivanov.essenty+AND+a:lifecycle&rows=5&wt=json" | \
jq -r '.response.docs[].v' | sort -V | tail -n 5

Length of output: 234


Script:

#!/bin/bash
# Check Essenty releases from a different Maven endpoint
echo "Checking Essenty releases..."
curl -s "https://repo1.maven.org/maven2/com/arkivanov/essenty/lifecycle/" | \
grep -o 'href="[0-9][^"]*/"' | cut -d'"' -f2 | sort -V | tail -n 5

Length of output: 275

@arkivanov arkivanov merged commit 806deeb into master Oct 23, 2024
3 checks passed
@arkivanov arkivanov deleted the update-essenty-and-compose branch October 23, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant