diff --git a/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/PageReducer.kt b/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/PageReducer.kt
index d2e9dd0..b2b6c3d 100644
--- a/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/PageReducer.kt
+++ b/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/PageReducer.kt
@@ -38,3 +38,8 @@ sealed interface PageAction : Action {
data class PageContainer
(
val page: SpiderPage
)
+
+fun PageContainer<*>.isDifferentPage(page: SpiderPage<*>): Boolean {
+ return page::class != this.page::class
+}
+
diff --git a/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryReducer.kt b/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryReducer.kt
index f66b2e9..5820b06 100644
--- a/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryReducer.kt
+++ b/features/messenger/src/main/kotlin/app/dapk/st/messenger/gallery/state/ImageGalleryReducer.kt
@@ -56,4 +56,10 @@ private fun SharedStateScope, Unit>>.c
dispatch(PageAction.UpdatePage(page.state.copy(content = Lce.Content(media))))
})
},
+
+ sideEffect(PageAction.GoTo::class) { action, _ ->
+ if (getSharedState().state1.isDifferentPage(action.page)) {
+ jobBag.cancel("page")
+ }
+ }
)