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

Add test params for retained state registry #1655

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

ZacSweers
Copy link
Collaborator

No description provided.

@@ -28,9 +32,10 @@ public suspend fun <UiState : CircuitUiState> Presenter<UiState>.test(
timeout: Duration? = null,
name: String? = null,
policy: SnapshotMutationPolicy<UiState> = structuralEqualityPolicy(),
retainedStateRegistry: RetainedStateRegistry = RetainedStateRegistry(),
Copy link
Contributor

@chrisbanes chrisbanes Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT to making this nullable (and default to null)?

Providing a default retainedStateRegistry is a bit of a foot gun, as it's so easy for devs to ignore. At least if we force people to provide a value, it's on them to track. If they don't provide a value, nothing is retained anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be game for that or default to NoopStateRegistry, though I'm still not sure this API is necessary to expose at the top level as the only use case right now was automatic-cleanup.

Copy link
Contributor

@chrisbanes chrisbanes Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is basically just recreating NoopStateRegistry. Maybe this PR isn't needed: if people want to provide a real registry in tests then they're free to do so. Might be worth a doc call out though.

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.

2 participants