Remember resource when building resource card -> doesn't work

Change-Id: I2af17da29e4434f12a81021aa8e0ec87860b21da
caren/onboarding_prevent_scroll_on_action
Caren 2 years ago
parent d2e028947e
commit dd011c6d3b

@ -55,17 +55,20 @@ fun LazyGridScope.newsFeed(
val resourceUrl by remember { val resourceUrl by remember {
mutableStateOf(Uri.parse(saveableNewsResource.newsResource.url)) mutableStateOf(Uri.parse(saveableNewsResource.newsResource.url))
} }
val savedResource by remember {
mutableStateOf(saveableNewsResource.isSaved)
}
val context = LocalContext.current val context = LocalContext.current
val backgroundColor = MaterialTheme.colorScheme.background.toArgb() val backgroundColor = MaterialTheme.colorScheme.background.toArgb()
NewsResourceCardExpanded( NewsResourceCardExpanded(
newsResource = saveableNewsResource.newsResource, newsResource = saveableNewsResource.newsResource,
isBookmarked = saveableNewsResource.isSaved, isBookmarked = savedResource,
onClick = { launchCustomChromeTab(context, resourceUrl, backgroundColor) }, onClick = { launchCustomChromeTab(context, resourceUrl, backgroundColor) },
onToggleBookmark = { onToggleBookmark = {
onNewsResourcesCheckedChanged( onNewsResourcesCheckedChanged(
saveableNewsResource.newsResource.id, saveableNewsResource.newsResource.id,
!saveableNewsResource.isSaved !savedResource
) )
} }
) )

Loading…
Cancel
Save