-
Notifications
You must be signed in to change notification settings - Fork 40
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
Fix remembers painter twice and break the cache #303
Conversation
devkanro
commented
Feb 17, 2024
- Move the InDebugMode property to foundation module.
- Rename the utils in foundation to util
- Fix remembers painter twice to break the cache, see the comments below.
@@ -166,7 +166,7 @@ public class ResourcePainterProvider( | |||
loadSvgPainter(inputStream, scope) | |||
} | |||
}, | |||
rememberAction = { remember(url, scope.density) { it } }, | |||
paintAction = { it }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -205,7 +205,7 @@ public class ResourcePainterProvider( | |||
loadingAction = { resourceUrl -> | |||
resourceUrl.openStream().use { loadXmlImageVector(InputSource(it), scope) } | |||
}, | |||
rememberAction = { rememberVectorPainter(it) }, | |||
paintAction = { rememberVectorPainter(it) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can still remember the vector because vector self is a key.
) | ||
|
||
@Composable | ||
private fun <T> tryLoadingResource( | ||
url: URL, | ||
loadingAction: (URL) -> T, | ||
rememberAction: @Composable (T) -> Painter, | ||
paintAction: @Composable (T) -> Painter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I rename the rememberAction to paintAction, it more seems like a action to convert T to a painter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!