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…
If this worked, I anticipate it would greatly speed up page time because we’d eliminate literally 100s of database searches throughout of app and use set state view things instead.
Not sure I follow. The problem is that I’m not able to reference the individual items within the multi-thing state. Can you clarify your idea. I’ll test it out.
Couldn’t get it to work. The issue may be that the multi-thing state is not a list, it’s a mini-table/view. Cannot seem to reference the rows. Happy to entertain any other ideas.
I just tried it, and also failed at runtime, I had a never-ending progress bar when trying to set the custom state to a search result of things. Weird, I’m sure it used to work.
Edit - it worked fine on a new app, something dodgy going on.
The custom state is happy to hold a list of things if I set it from a RG’s list.
Anyway this approach should work if you use a RG instead of a custom state as the main list of things.
Not sure what you mean here, do you define the custom state as type of thing, then tick the list checkbox?
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.