refactor(navigation): change backStack type to MutableList for improved flexibility#4
Open
maicol07 wants to merge 2 commits intoterrakok:mainfrom
Open
refactor(navigation): change backStack type to MutableList for improved flexibility#4maicol07 wants to merge 2 commits intoterrakok:mainfrom
maicol07 wants to merge 2 commits intoterrakok:mainfrom
Conversation
…ibility This way it can also be used with different structures other than a `SnapshotStateList` (such as Compose NavBackState)
There was a problem hiding this comment.
Pull request overview
Refactors the ChronologicalBrowserNavigation API to accept a List back stack (instead of SnapshotStateList) with the goal of supporting additional back stack implementations while keeping browser history and URL hash synchronized with in-app navigation.
Changes:
- Changed
ChronologicalBrowserNavigationand its internal binding function to acceptList<T>instead ofSnapshotStateList<T>. - Added runtime checks/casts to mutate the back stack only when the provided
Listis also aMutableList.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
.../commonMain/kotlin/com/github/terrakok/navigation3/browser/ChronologicalBrowserNavigation.kt
Show resolved
Hide resolved
.../commonMain/kotlin/com/github/terrakok/navigation3/browser/ChronologicalBrowserNavigation.kt
Outdated
Show resolved
Hide resolved
.../commonMain/kotlin/com/github/terrakok/navigation3/browser/ChronologicalBrowserNavigation.kt
Outdated
Show resolved
Hide resolved
Author
|
@terrakok, will this be merged along with a new release? |
Owner
|
No. Browser integration requires a mutable stack |
Author
Ok, I can change it with a MutableList if you agree |
… `backStack` and remove redundant type checks.
Author
|
@terrakok changed to |
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.
This way, it can also be used with different structures other than a
SnapshotStateList(such as Compose NavBackState)