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.
werks
July 5, 2021, 7:43pm
3
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.
werks:
Tried to implement this and getting the following error:
TypeError: this.element.requestSubmit is not a function. (In ‘this.element.requestSubmit()’, ‘this.element.requestSubmit’ is undefined)
I replicated it exactly as per your code except for changing article references to post references. The only differences are the latest Rails and Ruby 3.0.1.
Any suggestions what I should look into / am doing wrong?