loading...

Discussion on: Best approach for filter data, fetch again, array.filter?

Collapse
danspratling profile image
Dan Spratling

I would call the API every time the name value changes (only on user request, ie submit) and then use array.filter to manage and thing with known results (dropdowns, checkboxes, etc).

Some other things to consider.

When you request data you could return only pages around the requested page. This means more calls (and is more work to build), but each result is smaller (50 results instead of 5000). Depends on how much you want to optimise things (this is quite extreme).

You could cache results for popular searches or previous searches both servers ide for quick delivery but also in the users browser if they've already searched for it (so you don't re-fetch results).