This repository was archived by the owner on Nov 12, 2024. It is now read-only.
Repository navigation
Add retained caching for paging flows - #1763
Merged
Merged
Conversation
github-merge-queue Bot
pushed a commit
to slackhq/circuit
that referenced
this pull request
Feb 17, 2024
This PR manually calls `RememberObserver` calls as appropriate when used in `rememberRetained`. The semantics of `rememberRetained` are obviously different to `remember`, so we call them at different times: - `onRemembered` will be called the first time that the retained item is first `remember`ed. The difference here is that we will **not** call `onRemembered` again once a the object is restored and remembered back into composition. - `onForgotten` will be called only once the retained state is cleared from both composition and any retained registries. - Thus, the logical lifecycle is maintained of created (`onRemembered` called), through to being no longer retained/remembered (`onForgotten` called). - We do not call `onAbandoned` as retained state doesn't meet the contract of the function. I did think about creating a `RetainedObserver` interface, but figured that using the existing `RememberObserver`, even with slightly different semantics, is a better solution. This has a variety of use-cases, but I have been playing around with a `rememberRetainedCorotineScope` in Tivi: chrisbanes/tivi#1763
chrisbanes
force-pushed
the
cb/retained-coroutine-scope
branch
2 times, most recently
from
March 21, 2024 10:42
6c4c502 to
3f2cc71
Compare
chrisbanes
force-pushed
the
cb/retained-coroutine-scope
branch
from
April 19, 2024 10:23
3f2cc71 to
ab77b38
Compare
chrisbanes
marked this pull request as ready for review
April 19, 2024 10:23
chrisbanes
enabled auto-merge (squash)
April 19, 2024 10:24
chrisbanes
disabled auto-merge
April 19, 2024 10:31
We now use a `rememberRetainedCoroutineScope` to keep a CoroutineScope running in a retained state. This allows to then keep a retained `cachedIn` paging flow running too.
chrisbanes
force-pushed
the
cb/retained-coroutine-scope
branch
from
April 29, 2024 08:38
ab77b38 to
3bdef19
Compare
chrisbanes
enabled auto-merge (squash)
April 29, 2024 08:38
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
We now use a
rememberRetainedCoroutineScopeto keep a CoroutineScope running in a retained state. This allows to then keep a retainedcachedInpaging flow running too.