Utilizing an axios
ajax request, I am retrieving a JSON list of tags
related to a specific topic
selected from a dropdown. If no topic
is chosen, all tags in the database (approximately 100-200 tags) are fetched.
The process involves:
- User selects a
topic
from the dropdown menu - Listening for the
onChange
event and passing the selected value to the API usingaxios get()
. - Receiving a pre-filtered JSON array of objects from the database based on the selected
topic
Each time the user changes the topic
, a new call to the API/Database is triggered. An alternative method using filters has been observed but not utilized.
When creating a form, should all option values be loaded on beforeMount()
and then filtered based on selection? Or is it better practice to load options only when a user makes a selection?