moko-resources
moko-resources copied to clipboard
Slow loading of string resource at first open of screen
ios-cocoapods-static-framework.7z.zip
https://github.com/icerockdev/moko-resources/assets/315633/e4c7babb-13b7-47e3-a48c-c1c96c47e408
This is my modification based on your demo, and you can see that there is indeed a delayed response for moko to load.
The first time the app is run, there is a delayed response for moko loading, and it is normal to repeat the operation later.
Originally posted by @syxc in https://github.com/icerockdev/moko-resources/discussions/625#discussioncomment-9364093
https://github.com/icerockdev/moko-resources/discussions/625#discussioncomment-9354106 another demonstration
fun localizedString(stringRes: StringResource): String {
val bundle = StringDesc.localeType.getLocaleBundle(stringRes.bundle) <-- Here
val string = bundle.localizedStringForKey(stringRes.resourceId, null, null)
return if (string == stringRes.resourceId) {
stringRes.bundle.localizedStringForKey(stringRes.resourceId, null, null)
} else string
}
I'm do little research and without bundle we have normal performance.
fun localizedString(stringRes: StringResource): String { val bundle = StringDesc.localeType.getLocaleBundle(stringRes.bundle) <-- Here val string = bundle.localizedStringForKey(stringRes.resourceId, null, null) return if (string == stringRes.resourceId) { stringRes.bundle.localizedStringForKey(stringRes.resourceId, null, null) } else string }I'm do little research and without bundle we have normal performance.
ios-cocoapods-static-framework.7z.zip
You can take a look at the demo. You can actually see a slight loading delay in moko loading. This demo is your official example. Based on this, I added two new pages to simulate actual application scenarios. Other places No modifications were made. In fact, I am also very surprised as to why this happens.
@syxc
You can take a look at the demo.
I'm don't say "problem not found", but now i think problem with first replacement bundle content in RAM. Don't know, need research
@syxc
You can take a look at the demo.
I'm don't say "problem not found", but now i think problem with first replacement bundle content in RAM. Don't know, need research
@ExNDY Understood. Thanks a lot!
fix will be available in 0.24.0-beta-5