Coder Social home page Coder Social logo

Comments (4)

kuuuurt avatar kuuuurt commented on July 29, 2024 1

Hi @colintheshots. I added a refresh function on 0.6.0. Haven't really tested but just added it based on your comment above and used PagingSource.invalidate()

from multiplatform-paging.

kuuuurt avatar kuuuurt commented on July 29, 2024

Sorry for getting back to this late. The reason here is that for Android when you refresh, it's going to come from the adapter so we can't access it in the common code. Do you have any suggestions on how to make this possible in common code?

from multiplatform-paging.

colintheshots-meetup avatar colintheshots-meetup commented on July 29, 2024

I need to think this one over. I haven't had a chance to investigate what it might take yet.

from multiplatform-paging.

sed0 avatar sed0 commented on July 29, 2024

@kuuuurt using PageSource.invalidate method might work.

That's a comment from PagingDataAdapter:

/**
 * Refresh the data presented by this [PagingDataAdapter].
 *
 * [refresh] triggers the creation of a new [PagingData] with a new instance of [PagingSource]
 * to represent an updated snapshot of the backing dataset. If a [RemoteMediator] is set,
 * calling [refresh] will also trigger a call to [RemoteMediator.load] with [LoadType] [REFRESH]
 * to allow [RemoteMediator] to check for updates to the dataset backing [PagingSource].
 *
 * Note: This API is intended for UI-driven refresh signals, such as swipe-to-refresh.
 * Invalidation due repository-layer signals, such as DB-updates, should instead use
 * [PagingSource.invalidate].
 */
fun refresh()

A comment from Pager:

/**
 * A cold [Flow] of [PagingData], which emits new instances of [PagingData] once they become
 * invalidated by [PagingSource.invalidate] or calls to [AsyncPagingDataDiffer.refresh] or
 * [PagingDataAdapter.refresh].
 */
@OptIn(androidx.paging.ExperimentalPagingApi::class)
public val flow: Flow<PagingData<Value>>

from multiplatform-paging.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.