Real-time search with Rails + Hotwire

Hi, just want to share about tinkering with hotwire

I built this to demonstrate the ability we can achieve with hotwire.

To view the repo, click here.
https://github.com/sawirricardo/live-search-rails-hotwire

Any ideas to improve are welcomed. May be some patterns or best practices are welcomed for discussion.

Also, I update on Twitter @RicardoSawir. You can follow me there.

4 Likes

Neat, I just built exactly this myself for a feature! Was super happy with how simple and easy it ended up being.

Any ideas to improve are welcomed.

If this is a real project, you might want to consider debouncing your refresh() function so you’re not spamming your server on every key press.

UPDATE:

This is a temporary Safari issue where formElement.requestSubmit() is not supported. The easiest fix is to use a polyfill until the next Safari update where this has been resolved.