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

Renamed Pages composable function to ChildPages, promoted all Child Pages API to stable #756

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

arkivanov
Copy link
Owner

@arkivanov arkivanov commented Aug 7, 2024

Closes #752.

Summary by CodeRabbit

  • New Features

    • Introduced stable ChildPages functionality for enhanced child page routing and animation control.
    • Added overloaded ChildPages functions for greater flexibility in child page management.
  • Bug Fixes

    • Removed experimental annotations from several classes and functions, indicating a commitment to stability and reliability.
  • Refactor

    • Renamed the Pages function to ChildPages for clarity.
    • Updated test class from PagesTest to ChildPagesTest to reflect the new naming.
  • Documentation

    • Cleaned up unused import statements and annotations for a more streamlined codebase.

Copy link

coderabbitai bot commented Aug 7, 2024

Walkthrough

The recent changes enhance the stability of the decompose library by removing the @ExperimentalDecomposeApi annotation from multiple classes and functions, indicating their readiness for production use. The Pages class has been renamed to ChildPages, reflecting a more focused approach to child page management and improving the clarity of the API.

Changes

Files Change Summary
.../ChildPages.kt, .../ChildPagesFactory.kt, .../Pages.kt, .../PagesNavigation.kt, .../PagesNavigator.kt, .../PagesNavigatorExt.kt Removed @ExperimentalDecomposeApi annotation from classes and functions to indicate stability.
.../extensions-compose/pages/ComposableSingletons$PagesKt, .../extensions-compose/jvm/extensions-compose.api, .../extensions-compose/src/commonMain/kotlin/... Renamed Pages to ChildPages for clarity; added new function signatures for child page routing and animation.
.../extensions-compose/src/jvmTest/kotlin/.../ChildPagesTest.kt Renamed test class and functions from PagesTest to ChildPagesTest to align with the updated structure.
.../sample/shared/compose/src/commonMain/kotlin/.../PagesContent.kt Cleaned up unused import statements and removed @OptIn annotations, streamlining the content.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ChildPages
    participant Navigator

    User->>ChildPages: Request to display child pages
    ChildPages->>Navigator: Route to selected child page
    Navigator->>ChildPages: Render the requested child page
    ChildPages-->>User: Display child page content
Loading

🐇 In the code we hop and play,
With ChildPages here to stay!
No more experiments in the air,
Just stable paths for us to share.
Hooray for changes, bright and new,
A joyful journey, me and you! 🐇✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ad03ddf and 0c9bb36.

Files selected for processing (13)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/ChildPages.kt (2 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/ChildPagesFactory.kt (4 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/Pages.kt (1 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/PagesNavigation.kt (2 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/PagesNavigator.kt (1 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/PagesNavigatorExt.kt (7 hunks)
  • extensions-compose/api/android/extensions-compose.api (1 hunks)
  • extensions-compose/api/extensions-compose.klib.api (1 hunks)
  • extensions-compose/api/jvm/extensions-compose.api (1 hunks)
  • extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPages.kt (8 hunks)
  • extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/PagesScrollAnimation.kt (1 hunks)
  • extensions-compose/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPagesTest.kt (3 hunks)
  • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/pages/PagesContent.kt (2 hunks)
Files skipped from review due to trivial changes (7)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/ChildPages.kt
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/Pages.kt
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/PagesNavigation.kt
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/PagesNavigator.kt
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/PagesNavigatorExt.kt
  • extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/PagesScrollAnimation.kt
  • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/pages/PagesContent.kt
Additional comments not posted (16)
extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPages.kt (3)

Line range hint 141-145:
LGTM!

The removal of the experimental annotation indicates the API is now stable.


Line range hint 25-36:
LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to ChildPages match the new signature.


Line range hint 51-95:
LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to ChildPages match the new signature.

extensions-compose/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPagesTest.kt (2)

Line range hint 150-156:
LGTM!

The test function setContent is correctly updated to use ChildPages.


17-17: LGTM! But verify the function usage in the codebase.

The class and its test functions are correctly renamed.

However, ensure that all function calls to ChildPages match the new signature.

Verification successful

Function calls to ChildPages match the new signature.

The instances of ChildPages across the codebase have been reviewed and they all use the correct signature.

  • Verified in:
    • sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/pages/PagesComponent.kt
    • sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/pages/DefaultPagesComponent.kt
    • extensions-compose/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPagesTest.kt
    • extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPages.kt
    • decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/pages/ChildPagesBackButtonTest.kt
    • decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/pages/ChildPagesSelectLastTest.kt
    • decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/pages/ChildPagesSelectFirstTest.kt
    • decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/pages/ChildPagesSelectTest.kt
    • decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/pages/ChildPagesSelectPrevTest.kt
    • decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/pages/ChildPagesSelectNextTest.kt
    • decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/pages/ChildPagesSavedStateTest.kt
    • decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/pages/ChildPagesClearTest.kt
    • decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/pages/BaseChildPagesTest.kt
    • decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/pages/ChildPagesIntegrationTest.kt
    • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/ChildPagesFactory.kt
    • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/ChildPages.kt
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `ChildPages` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type kotlin -A 5 $'ChildPages'

Length of output: 33910

decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/ChildPagesFactory.kt (3)

Line range hint 26-51:
LGTM!

The removal of the experimental annotation indicates the API is now stable.


Line range hint 72-114:
LGTM!

The removal of the experimental annotation indicates the API is now stable.


Line range hint 116-116:
LGTM! But verify the class usage in the codebase.

The removal of the class PagesSavedNavState suggests a simplification or refactoring of state management.

However, ensure that the removal does not affect other parts of the codebase.

Verification successful

LGTM! The removal of the PagesSavedNavState class does not affect other parts of the codebase.

  • The search command confirmed that there are no occurrences of PagesSavedNavState in the codebase.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of `PagesSavedNavState` in the codebase.

# Test: Search for the class usage. Expect: No occurrences of the class.
rg --type kotlin -A 5 $'PagesSavedNavState'

Length of output: 42

extensions-compose/api/android/extensions-compose.api (3)

8-9: LGTM! Verify the usage of defaultHorizontalPager and defaultVerticalPager.

The code changes are approved.

However, ensure that the new functions defaultHorizontalPager and defaultVerticalPager are used correctly in the codebase.

Verification successful

Verified the usage of defaultHorizontalPager and defaultVerticalPager.

The functions are correctly defined and used within the ChildPages.kt file.

  • defaultHorizontalPager is used twice within the ChildPages composable function.
  • defaultVerticalPager is defined and used correctly.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `defaultHorizontalPager` and `defaultVerticalPager` functions in the codebase.

# Test: Search for the function usage. Expect: Correct usage of the new functions.
rg --type kotlin -A 5 $'defaultHorizontalPager'
rg --type kotlin -A 5 $'defaultVerticalPager'

Length of output: 3450


Script:

#!/bin/bash
# Extract more context around the usages of `defaultHorizontalPager` and `defaultVerticalPager` in `ChildPages.kt`
rg --type kotlin -A 10 -B 10 $'defaultHorizontalPager' extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPages.kt
rg --type kotlin -A 10 -B 10 $'defaultVerticalPager' extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPages.kt

# Search for any other references to `defaultHorizontalPager` across the entire codebase
rg --type kotlin $'defaultHorizontalPager'

# Search for any other references to `defaultVerticalPager` across the entire codebase
rg --type kotlin $'defaultVerticalPager'

Length of output: 3301


6-7: Ensure proper usage of overloaded ChildPages functions.

The new ChildPages functions provide enhanced flexibility. Verify that the correct function overload is used in the codebase.

Verification successful

Ensure proper usage of overloaded ChildPages functions.

The new ChildPages functions provide enhanced flexibility. Verify that the correct function overload is used in the codebase.


Ensure proper usage of overloaded ChildPages functions.

The new ChildPages functions provide enhanced flexibility. Based on the gathered context, the correct function overloads appear to be used in the codebase.

  • In PagesComponent.kt, pages is of type Value<ChildPages<*, KittenComponent>>, which matches the first overload.
  • In DefaultPagesComponent.kt, pages is also of type Value<ChildPages<*, KittenComponent>>, which matches the first overload.
  • In ChildPagesTest.kt, the usages of ChildPages with items and selectedIndex match the second overload.
  • In ChildPages.kt, both overloads are used correctly based on the provided contexts.

No issues found with the usage of ChildPages overloads.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of overloaded `ChildPages` functions in the codebase.

# Test: Search for `ChildPages` function usage. Expect: Correct overloads are used.
rg --type kotlin -A 5 $'ChildPages'

Length of output: 33910


Script:

#!/bin/bash
# Description: Extract function signatures and usage contexts for `ChildPages` to verify correct overload usage.

# Extract function signatures of `ChildPages`
echo "Function Signatures:"
rg --type kotlin --context 5 'fun <C : Any, T : Any> ChildPages' extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPages.kt

# Extract context around each usage of `ChildPages`
echo "Usage Contexts:"
rg --type kotlin -A 10 -B 2 'ChildPages' sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/pages/PagesComponent.kt
rg --type kotlin -A 10 -B 2 'ChildPages' sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/pages/DefaultPagesComponent.kt
rg --type kotlin -A 10 -B 2 'ChildPages' extensions-compose/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPagesTest.kt
rg --type kotlin -A 10 -B 2 'ChildPages' extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPages.kt
rg --type kotlin -A 10 -B 2 'ChildPages' decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/ChildPagesFactory.kt

Length of output: 11036


12-13: LGTM! Ensure singleton pattern is maintained correctly.

The code changes are approved.

However, verify that the singleton pattern for ChildPages is maintained correctly in the codebase.

extensions-compose/api/jvm/extensions-compose.api (3)

10-11: Ensure proper usage of overloaded ChildPages functions.

The new ChildPages functions provide enhanced flexibility. Verify that the correct function overload is used in the codebase.


12-13: LGTM! Verify the usage of defaultHorizontalPager and defaultVerticalPager.

The code changes are approved.


16-17: LGTM! Ensure singleton pattern is maintained correctly.

The code changes are approved.

extensions-compose/api/extensions-compose.klib.api (2)

89-90: Ensure proper usage of overloaded ChildPages functions.

The new ChildPages functions provide enhanced flexibility. Verify that the correct function overload is used in the codebase.


90-90: Ensure proper usage of predictiveBackAnimation functions.

The new predictiveBackAnimation functions provide enhanced flexibility. Verify that the correct function overload is used in the codebase.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0c9bb36 and 36c5d88.

Files selected for processing (13)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/ChildPages.kt (2 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/ChildPagesFactory.kt (4 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/Pages.kt (1 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/PagesNavigation.kt (2 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/PagesNavigator.kt (1 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/PagesNavigatorExt.kt (7 hunks)
  • extensions-compose/api/android/extensions-compose.api (1 hunks)
  • extensions-compose/api/extensions-compose.klib.api (1 hunks)
  • extensions-compose/api/jvm/extensions-compose.api (1 hunks)
  • extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPages.kt (8 hunks)
  • extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/PagesScrollAnimation.kt (1 hunks)
  • extensions-compose/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPagesTest.kt (3 hunks)
  • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/pages/PagesContent.kt (2 hunks)
Files skipped from review as they are similar to previous changes (12)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/ChildPages.kt
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/ChildPagesFactory.kt
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/Pages.kt
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/PagesNavigation.kt
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/PagesNavigator.kt
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/pages/PagesNavigatorExt.kt
  • extensions-compose/api/extensions-compose.klib.api
  • extensions-compose/api/jvm/extensions-compose.api
  • extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPages.kt
  • extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/PagesScrollAnimation.kt
  • extensions-compose/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPagesTest.kt
  • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/pages/PagesContent.kt
Additional comments not posted (3)
extensions-compose/api/android/extensions-compose.api (3)

Line range hint 14-29: Ensure correct implementation of page scroll animations.

The class PagesScrollAnimation and its subclasses Custom, Default, and Disabled handle page scroll animations. Ensure that the animations are implemented correctly and efficiently.


5-10: Ensure consistency in function naming and parameters.

The class ChildPagesKt introduces new functions ChildPages, defaultHorizontalPager, and defaultVerticalPager. Ensure that the function parameters and naming conventions are consistent with the rest of the codebase.

Verification successful

To ensure consistency in function naming and parameters for the ChildPages functions, we need to locate their definitions in the main codebase. This will help us verify their consistency with the rest of the codebase.


To locate the definitions of the ChildPages functions in the main codebase, we need to perform a broader search. This will help ensure that we are reviewing the correct implementations.


The broader search results show multiple usages and definitions of ChildPages across various files. The main implementation of ChildPages appears to be in ChildPages.kt. The definitions found in this file are crucial for verifying the consistency of function naming and parameters.

Ensure consistency in function naming and parameters.

The definitions of ChildPages functions in ChildPages.kt should be reviewed to ensure they are consistent with the rest of the codebase.

  • File: extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/pages/ChildPages.kt
  • Functions to review:
    • fun <C : Any, T : Any> ChildPages(pages: Value<ChildPages<C, T>>, ...)
    • fun <C : Any, T : Any> ChildPages(pages: ChildPages<C, T>, ...)
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of function parameters and naming conventions.

# Test: Search for the function definitions. Expect: Consistent naming and parameters.
rg --type kotlin -A 5 $'fun ChildPages'
rg --type kotlin -A 5 $'fun defaultHorizontalPager'
rg --type kotlin -A 5 $'fun defaultVerticalPager'

Length of output: 4040


Script:

#!/bin/bash
# Description: Locate the definitions of the ChildPages functions in the main codebase.

# Search for the definition of the ChildPages function in the main codebase.
rg --type kotlin 'fun ChildPages'

Length of output: 559


Script:

#!/bin/bash
# Description: Perform a broader search to locate the definitions of the ChildPages functions in the main codebase.

# Search for the definition of the ChildPages function in all Kotlin files.
rg --type kotlin 'ChildPages'

Length of output: 6888


12-13: Verify the singleton pattern implementation.

The class ComposableSingletons$ChildPagesKt implements a singleton pattern. Ensure that the singleton pattern is correctly implemented and thread-safe.

@arkivanov arkivanov merged commit 2a466cc into master Aug 7, 2024
2 checks passed
@arkivanov arkivanov deleted the stabilize-pages branch August 7, 2024 18:10
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.

Promote Child Pages API to stable
1 participant