This is great, thanks Daveyon. Really interesting to see how DHH approaches controllers too.
I added in a spinner target and method to my stimulus controller as well, just so there's some instant feedback for the user.
Also, the first entry of the event.detail array removed all of my table tags :s. So, I ended up using the third entry instead.
What are your thoughts on the requests being triggered at every keyup in terms of server load? I had a quick look around and there's solutions to delay the request for 500ms to see if another event is fired, but then that delays the result to the user.
Shopify seem to fire a request off on every keyup, so that's what I'm doing for now.
I believe Shopify uses GraphQL for their fetching? I have not taken into consideration server load etc. You many want to cache the results or fire the query when the user enters at least 2 characters. What you've done looks cool.
This is great, thanks Daveyon. Really interesting to see how DHH approaches controllers too.
I added in a
spinner
target and method to my stimulus controller as well, just so there's some instant feedback for the user.Also, the first entry of the
event.detail
array removed all of my table tags :s. So, I ended up using the third entry instead.What are your thoughts on the requests being triggered at every
keyup
in terms of server load? I had a quick look around and there's solutions to delay the request for 500ms to see if another event is fired, but then that delays the result to the user.Shopify seem to fire a request off on every keyup, so that's what I'm doing for now.
Hi oliwoodsuk.
I believe Shopify uses GraphQL for their fetching? I have not taken into consideration server load etc. You many want to cache the results or fire the query when the user enters at least 2 characters. What you've done looks cool.
Yeah, pretty sure your right actually. Ah yep, good idea. I think I'll do just that.