Help me understand data storage in Canvas Preview

I’m looking to create a very basic web app and I’m struggling with data storage in the Preview environment. In short, whenever I make any updates to the app (or ask a question in Canvas) I lose my stored data that I’ve added through the app.

I’ve quickly narrowed this down to the most obvious culprit which is that “app_id” changes everytime the session is refreshed. However, the basic solutions suggested are to add ‘permanent storage’ but making the app_id static and I’ve been unable to make this work.

Gemini assures me that this is possible but all of its attempts to either edit the code itself, or give me suggestions, have failed.

I want to clarify that I have very little experience so am probably missing something fundamental. Is this actually achievable in a Preview Environment (without deploying) or has Gemini been gaslighting me constantly?

I’ve been using Firestore as suggested but we seem to have been unable to make static id work. The actual app itself is incredibly simple but I’d love to have some help. I’ve struggled to find any discussion on this.