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

Idea: emptyText could be a function for reactivity #150

Open
tbremer opened this issue Feb 1, 2023 · 1 comment
Open

Idea: emptyText could be a function for reactivity #150

tbremer opened this issue Feb 1, 2023 · 1 comment

Comments

@tbremer
Copy link

tbremer commented Feb 1, 2023

Happy to make a PR, but wanted to make sure you'd be interested.

I'd love to see the emptyText option expand to be either a function, a string, or undefined. This would enable some level of reactivity for that portion of the prompt.

Example: I have a list of items, but a user is allowed to create unique items (with suggestOnly: true option), instead of printing No results... I could print a more useful message, such as: Add "searchTerm" to database.

in code example:

{
    
    emptyText: (searchTerm) => `Add ${searchTerm} to database`,
    
}
@mokkabonna
Copy link
Owner

mokkabonna commented Feb 27, 2023

Sure that could be useful, if you decide to do it you should also add it for searchText then at the same time I think.

And the function should probably receive the same input as the source function: answers and input.
That way you can construct even more dynamic text based on earlier input.

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

No branches or pull requests

2 participants