Forum Academy Marketplace Showcase Pricing Features

How to speed up loading from a small custom data type

I have a data type MENU ITEMS that consists of some 50 items.
These are menu options that the user can search for in an input.

I display these menu options dynamically by searching MENU ITEMS that contain the user input.

However it takes 2-3 seconds to show the relevant items every time the input changes.

How do I speed this up? This is a small table whose data hardly changes. Is there a way to download the table locally and search the local database from there?

Hey @jayy!
Have you tried loading the menu items into a list on page load and then referencing the list instead of searching the database?

1 Like

@Jett hmm never knew this was possible. Awesome - thanks a lot, let me try!

@Jett just tried - the speed is still the same. Upon page load, I created a custom state that contains the list of menu items. However I believe the list merely references the database, and doesn’t actually store the data locally (correct me if I’m wrong).

Another thing I noticed - for a constraint like “field name = something”, it’s fast. But if the constraint is “field name contains something”, it’s slow. Not sure if there’s any way to speed up partial search.

Let me know if you’ve any thoughts on this. Thanks so much!

Without context it’s a bit hard to know what you exactly want/need, but have you tried converting it to a list of texts?

1 Like

No i haven’t. Let me try this. Thanks!!!