Next.js Discord

Discord Forum

Best way of loading big CSV file into app

Unanswered
Gray-crowned Yellowthroat posted this in #help-forum
Open in Discord
Gray-crowned YellowthroatOP
Hi,
I have an application which needs to load a static CSV dataset.

The thing is there are lots of ways of importing it and I'm trying to find the most appropiate and efficient.

I want to start downloading this file in the background as soon as the app is fully loaded, so that when the user reaches the app page with the dataset viz it's already on the cache. And, of course, try to keep it in the cache as it won't change often.

I tried SWR but I think it's not appropiate for this case as it revalidates the dataset on each state update (even if it doesnt change the key of the dataset - it takes 500ms).

Now, I think fetch triggered from the initial page load and saved it in global state is the best way. But I want to discuss this decision and see if there is something better.

0 Replies