Hello everyone,
I’ve come across something that I don’t really understand. In short, it’s about a custom state during page load that has no reference in the app but still massively reduces my loading times.
To explain:
I’m currently building a fairly data-heavy app and have set up a dashboard with a central chart that bundles all user data.
I use Charts.JS and fill the maximum 3 y-values with database searches.
These are classic “Do a Search for” queries, not states.
If I run the app exactly like this, views with large date windows in particular take forever to load (sometimes up to 15 seconds).
I wanted to solve the filling of the y-values with a custom state that preloads everything on page load, so that I only have to filter minimally and no longer have to build huge search queries.
So I set up a custom state on page load that stores all user data up to a maximum time window of 90 days.
So far, I haven’t replaced any of the y-value searches. This means that the list in the custom state is there when the page loads, but it’s not used in the charts. Nevertheless, my loading times have been massively reduced (from up to 15 seconds to 1-3 seconds).
When I click through all the filter options of the chart in the preview for testing purposes, I now also see that I only have a minimal workload at page load and then it is at 0.
The moment I remove the Customestate on page load, i end up with the same heave workload usage and long loading times as before.
Perhaps I haven’t quite understood how custom states work yet. This approach is new to me, at least.
Additional information:
I have currently filled the app with approx. 3000 rows of test data.
Can someone explain to me what is happening here?