Trying out an idea, but unclear if it’s a no-go or I’m just not doing it right.
Goal: Reduce page load time by eliminating "Search for"s.
How: Set one BIG set state that instead of storing a single variable, stores a small view or thing worth of data. I’d then reference this set state thing in the actions on the page where today I’m doing separate "Search for"s to get this same data.
Question: Is it possible to run one “Search for” to set a state thing that I can reference in actions throughout the page?
I’ve given this idea a shot and it seems to sort of work, but I cannot seem to reference individual items in what I’m calling my set state thing.
Here’s the set up:
Set a state that holds multiple columns and rows from my database (eg. 3 tickets including name, price, id)
Then, without needing to do another database search, I use the “event-form” state above as the input and call attempt to store item #1 into a new state.
(eg. store ticket #1, using the above multi-item search result)
I can see that the multi-item search found 3 tickets, say, but I cannot seem to call individual items. Eg. the second set state for ticket item #1 is empty The debugger tells me so…
Good idea. Will give it a try and see how much of faster the page could be.
Just to summarize this thread/hack:
Pages which have multiple "Search for"s on the same table might benefit from instead storing the data as a one-pixel repeating group and calling the data from that group. This will reduce the number of hits on the database and thus should speed up the page.