1. does store data inside a viewmodel has a correl...
# compose
f
1. does store data inside a viewmodel has a correlation with a room data persistency? same with firebase etc
s
1st https://kotlinlang.slack.com/archives/C04TPPEQKEJ/p1711990921916479?thread_ts=1711986317.997799&cid=C04TPPEQKEJ 2nd what you are doing [pic attached] is going against this slack's guidelines. Please stop doing that
f
ok, soz
so im trying to make my fitness app and now that i m makin the second menu i figured out that when i change menus the data inside a page disappear, so i thought to add data inside a viewmodel, but if i can rely on room and firebase... what do u think?
s
I am sorry, I am not going to reply if you are going to be spamming the channel like that. Please read this https://kotlinlang.org/community/slackccugl.html#basic-usage-guidelines
f
? i stopped
s
The messages are still cross posted on the other channels
f
deleted too
s
Thank you
🙌 1
f
so.. what do u think?
c
Not sure I understand your question.
In general though. room, dataStore/sharedPrefs, writing a file to disk, firebase, etc all make changes outside of your viewModel and are persisted so that they survive across reboots. so even though you might access room, dataStore/sharedPrefs, writing a file to disk, firebase, etc through a ViewModel, the data lives outside of that scope.
f
ok so Datastore mh can i use it rn? i mean for a oversight i didn't pass the datas inside the vm so the data while changing menu are gonna be deleted. So, can i use it without the lifecycle inside the viewmodel?
c
I really can't make out the question you're asking.
f
so i made a menu without the lifecycle function. so if i change to landscape all datas goes away, to fix that i just need the lifecycle no? but still if i close the app i lose data. at this point can i just use the data store as u mentioned before?
c
yeah. if you save it to a place (like room or datastore) you can reload that data on config change.
f
okkk nice to know ahah
thanks for the infooo