Stan Kocken
02/14/2024, 3:24 PMstringResource
when using the formatArgs?
For example stringResource(Res.string.mystring, param1, param2)
.
Sometimes it will return a previous instance of it, not with the new value of param1
. Tested on the latest v1.6.0-rc01
but still present.
Looking at the source code I don't even understand how it works:
fun stringResource(resource: StringResource, vararg formatArgs: Any): String {
val resourceReader = LocalResourceReader.current
val args = formatArgs.map { it.toString() }
val str by rememberResourceState(resource, { "" }) { env ->
loadString(resource, args, resourceReader, env)
}
return str
}
the "args" are only used within the remember, and this line is not called when I have the bug in my case.Joel Denke
02/14/2024, 3:32 PMval args = remember(formatArgs) {
formatArgs.map ...
}
However I am not entirely sure. Is your params dynamic and shifts value, like from an uiState or such?Stan Kocken
02/14/2024, 7:46 PMString
, coming from a list of items…
But I really don't get why sometimes it works, sometimes it does not. And of course I'm not able to reproduce it within a smaller project to open an official bug on the bug tracker.Joel Denke
02/14/2024, 8:36 PMlouiscad
02/15/2024, 9:17 PMStan Kocken
02/17/2024, 9:12 AMStan Kocken
02/17/2024, 10:03 AMStan Kocken
02/20/2024, 8:15 PMlouiscad
02/21/2024, 12:33 AMzsmb
02/21/2024, 6:40 AMlouiscad
02/21/2024, 10:09 AM