Transferring a large array of data between pages

I’m creating a web app on Wix that will feature a user sign-in. Upon sign-in, the app will query a Google Cloud database, and retrieve user specific data to populate dynamic pages.

I chose to store this information using Google Cloud - and not Wix - just because of the sheer volume of data (thousands of rows for many users). I’m running into a problem because I have multiple pages that the user will need to navigate back-and-forth between. To save on time and data costs, I only want to query the Google database one time per user session (when the user logs into the app), and after the data is brought into Wix, store the data temporarily for the rest of the user’s session. The alternative would be to execute a query to Google’s servers every time a user switches between pages which would be costly and greatly impact site performance.

The data comes in as a large array of object. I had two initial solutions to pass this array between site pages, but neither worked:

  1. Stringify the data and store it as a session item using wix-storage. This would be the ideal solution, but the session storage limit gets used pretty quickly (it can only store around 10 rows of data).

  2. Pass the data to a backend code file and store the array there. This works, but unfortunately this doesn’t act as a session item and every user would be able to see the exact same data once it’s stored in the code file. This would not be ideal either, as every user has unique data.

Has anyone ever come across this same issue before? Are there any possible workarounds? Or would I simply have to execute queries to the database each time a user switches pages?

Thank you in advance for any answers!

Your first consideration should be if there’s any issues with privacy and security regarding that data. With that question to the side…

For what you describe, you might be able to use wix-storage.memory to make the data available to all of the pages in the site. As stated in the API docs : “You can store up to 1mb of data in memory storage.”