Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to use local options #133

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

krzyzak
Copy link

@krzyzak krzyzak commented Mar 2, 2023

Hey!

First of all, thank you for this component, it's very useful in my project!
As a follow-up to #116, I added possibility to pass options Array, which then can be used in the component.

It also exposes 2 methods:

  • optionMatches - by default, it does case-insensitive matching, but it can be customised.
  • decorateResult - which can decorate options with whatever markup is needed in your app.

It allows you to pass not only a plain array, but also an array of objects, with different name and values.

I didn't update the docs, nor did I provide any examples, because first I wanted to get your initial feedback on that.

@netlify
Copy link

netlify bot commented Mar 2, 2023

Deploy Preview for stimulus-autocomplete canceled.

Name Link
🔨 Latest commit 7bc62b3
🔍 Latest deploy log https://app.netlify.com/sites/stimulus-autocomplete/deploys/6400b091e2730b0008500536

@ajhepple
Copy link

This is just the feature I wanted, thanks, but the proposed changes broke my remotely fetched options.
Thankfully it was a simple fix, to add parentheses around the use of the ternary operator;

const html = await (this.hasOptionsValue ? this.fetchLocalOptions(query) : ...

Otherwise the wait doesn't apply to the remote fetch!

Copy link

netlify bot commented Oct 14, 2024

Deploy Preview for stimulus-autocomplete canceled.

Name Link
🔨 Latest commit 40ece79
🔍 Latest deploy log https://app.netlify.com/sites/stimulus-autocomplete/deploys/670d7a43cfd0980008d4565f

@krzyzak
Copy link
Author

krzyzak commented Oct 14, 2024

@ajhepple you're right, I fixed That. @afcapel any chance to get that merged&released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants