Font loaded for multiple times
On Compose js (canvas based) paltform
I loaded some fonts to for a customized MaterialTheme, but the fonts seems to be loaded for multiple times, which obviously slow down page loading.
Is there any workaround to prevent this?
hi. i think you use asFont extension
https://github.com/icerockdev/moko-resources/blob/6b320c12e07e57c866d787841e8a5b41c583808d/resources-compose/src/jsMain/kotlin/dev/icerock/moko/resources/compose/FontResource.js.kt#L18
and as you can see in this extension - result of downloading is saved by produce in compose memory. so if you see multiple load of specific fonts i suggest to check recompositions with changing structure of tree (in this case all remembered for composable data will be cleared)
Yes, I used asFont extension, even outside the MaterialTheme scope, it still load for multiple times during the page loading, I think it might be compose things for the Theme recompose for multipose times, so I choose another solution not rely on compose: https://github.com/ISNing/XWareManage/commit/7c3d63ce93efa6bc169f2c33c5c8be3511f59bb4
I think mabe I should close this issue?