Hi <@U02AB5P2XU6>, I noticed that for pages that I...
# kobweb
f
Hi @David Herman, I noticed that for pages that I load data in the
LaunchedEffect
after I navigate to another page then navigate back. The launched effect is triggered again. Please confirm if this is the expected behavior or suggest how to load the data once.
d
Yes, for sure. This would be like having a LaunchedEffect in an screen in Android. I imagine it would fire again when you exited and reentered the screen?
You may want to use
LocalStorage
or
SessionStorage
if you want something to survive across pages
f
Yeah it is the same behavior in compose android. I'll look into session storage, thanks.
d
Sounds good. LaunchedEffect will fire the first time any composable goes from not being called to being called. You can look at your method annotated with
@App
also btw. Any launched effect in there should only be called once (or if one of its keys change)
f
Oh thanks, I'll check that out too. Thank you very much.
d
You're welcome!