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

Feed Loading Strategy #62

Merged
merged 3 commits into from
Jul 10, 2024
Merged

Feed Loading Strategy #62

merged 3 commits into from
Jul 10, 2024

Conversation

Rahkeen
Copy link
Collaborator

@Rahkeen Rahkeen commented Jul 9, 2024

This is an idea I have to load the feed lazily given the current infrastructure.

When we request a feed, we have a list of ID's, so we can populate our LazyList with a bunch of Loading State items.

Whenever I Loading State item comes into the Composition, it launches a SideEffect which will call up to the ViewModel to fetch that item. This seems like a decent approach without having to explicitly manage a paging mechanism in the ViewModel.

After second thought, I think the better approach is paging. And since we don't have actual paging via the API, we can simulate it.

Created a simple repository layer which wraps the actual base client, and adds the ability to request pages.
The requests are still sequential, but that can be updated later to be a series of async requests.

Some rationale here is that although with first approach we can keep scrolling, a fling will cause a bunch of network requests which could end up being quite costly.

The only thing that is a bit funky is the LazyList detecting how close we are to the end logic. I think this solution works but it probably needs more testing.

@Rahkeen Rahkeen force-pushed the lazy-loading-feed-strategy branch from c9624b2 to 904966b Compare July 9, 2024 23:38
@Rahkeen Rahkeen self-assigned this Jul 10, 2024
Rahkeen added 2 commits July 10, 2024 16:04
This is an idea I have to load the feed lazily given the current infrastructure.

When we request a feed, we have a list of ID's, so we can populate our LazyList with a bunch of Loading State items.

Whenever I Loading State item comes into the Composition, it launches a `SideEffect` which will call up to the ViewModel to fetch that item.
After second thought, I think the better approach is paging. And since we don't have actual paging
via the API, we can simulate it.

Just create a simple repository layer which wraps the actual base client, and adds the ability to request pages.
The requests are still sequential, but that can be updated later to be a series of async requests.

Some rationale here is that although with first approach we can keep scrolling, a fling will cause a bunch of network requests
which could end up being quite costly.

The only thing that is a bit funky is the LazyList detecting how close we are to the end logic. I think this solution works but it probably needs
more testing.
@Rahkeen Rahkeen force-pushed the lazy-loading-feed-strategy branch from 904966b to 0b4f226 Compare July 10, 2024 23:04
@Rahkeen Rahkeen assigned rbro112 and unassigned Rahkeen Jul 10, 2024
@Rahkeen Rahkeen merged commit f1e12c8 into main Jul 10, 2024
4 of 5 checks passed
@Rahkeen Rahkeen deleted the lazy-loading-feed-strategy branch July 10, 2024 23:40
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