From 36a2d7ec8e71ff231a42ee4b375834c9043bc552 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 18 Jun 2025 14:31:01 +0600 Subject: [PATCH] small improvement of InfinityPagedComponent and add opportunity to set publishing type --- build.gradle | 2 +- .../kotlin/InfinityPagedComponent.kt | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 3de377fb652..4d1377d9504 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,7 @@ if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != n username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') verificationTimeout = Duration.ofHours(4) - publishingType = "USER_MANAGED" + publishingType = System.getenv('PUBLISHING_TYPE') != "" ? System.getenv('PUBLISHING_TYPE') : "USER_MANAGED" } publishAllProjectsProbablyBreakingProjectIsolation() diff --git a/pagination/compose/src/commonMain/kotlin/InfinityPagedComponent.kt b/pagination/compose/src/commonMain/kotlin/InfinityPagedComponent.kt index a30a2b98a54..553a0cfc4fd 100644 --- a/pagination/compose/src/commonMain/kotlin/InfinityPagedComponent.kt +++ b/pagination/compose/src/commonMain/kotlin/InfinityPagedComponent.kt @@ -82,9 +82,25 @@ fun rememberInfinityPagedComponentContext( size: Int, page: Int = 0, scope: CoroutineScope = rememberCoroutineScope(), + doReloadInInit: Boolean = true, loader: suspend InfinityPagedComponentContext.(Pagination) -> PaginationResult -) = remember { - InfinityPagedComponentContext(page = page, size = size, scope = scope, loader = loader) +): InfinityPagedComponentContext { + val context = remember { + InfinityPagedComponentContext( + page = page, + size = size, + scope = scope, + loader = loader + ) + } + + LaunchedEffect(context) { + if (doReloadInInit) { + context.reload() + } + } + + return context } /**