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

Enable circuit-retained without composition local manual setup #1670

Open
takahirom opened this issue Sep 20, 2024 · 3 comments
Open

Enable circuit-retained without composition local manual setup #1670

takahirom opened this issue Sep 20, 2024 · 3 comments
Labels
discussion Open discussions! enhancement New feature or request
Milestone

Comments

@takahirom
Copy link

takahirom commented Sep 20, 2024

Thank you for developing this fantastic library. I’d like to use circuit-retained with Jetpack Navigation (or JetBrains Compose Multiplatform Navigation) without needing to set up a composition local for rememberRetained{}. Is this possible, or could you provide guidance on how to achieve this?

@takahirom takahirom changed the title Sample or Integration Implementation using circuit-retained with Jetpack Navigation (or JetBrains Compose Multiplatform Navigation) Enable circuit-retained without composition local setup Sep 20, 2024
@takahirom takahirom changed the title Enable circuit-retained without composition local setup Enable circuit-retained without composition local manual setup Sep 20, 2024
@stagg
Copy link
Collaborator

stagg commented Sep 28, 2024

I think this would be possible. Would need to pull something together to setup a multi-platform continuity instance as a default. Wouldn't necessarily want to do that setup at each retained use though 🤔

Think at a minimum we should add a RetainedCompositionLocals. Like the CircuitCompositionLocals we have in foundation that sets up the continuity registry for circuit. Would make it easier to use retained on it's own.

Curious whats the limitation around setting up a composition local, or adding a RetainedCompositionLocals, for this at the root level?

@takahirom
Copy link
Author

takahirom commented Sep 28, 2024

I think managing the backstack might be challenging if only one composition local is provided. It might be beneficial if we could use ViewModels and Lifecycles from Compose Multiplatform instead of relying on the current composition local to achieve smooth integration, assuming they do not already exist. However, this approach may be very complex.

@stagg
Copy link
Collaborator

stagg commented Oct 3, 2024

Ahh so specifically an integration with Jetpack/Compose Navigation where the view model store is setup per route. We're doing something similar in NavigableCircuitContent for the LocalRetainedStateRegistry.

Could be doable, let folks provide a default instead of the NoOpRetainedStateRegistry 🤔 Involves some sort of a factory which would default to using a multi-platform continuity.
This would be assuming a lot about the lifecycle, which I think ties this down to being a very Jetpack Navigation specific change.

@ZacSweers ZacSweers added enhancement New feature or request discussion Open discussions! labels Oct 23, 2024
@ZacSweers ZacSweers added this to the 1.0.0 milestone Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Open discussions! enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants