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

Allow re-rendering after the data in a prompt becomes stale (maybe by allowing cancellation?) #170

Open
darklajid opened this issue Aug 2, 2023 · 3 comments

Comments

@darklajid
Copy link

Is your feature request related to a problem? Please describe.

I have a Select to let the user - well - select items and toggle some state based on that. Occasionally some items on the list change or new items are added - but that isn't reflected in the Select prompt of course.

Describe the solution you'd like

I would like to be able to ideally cancel (or otherwise: timeout) a prompt to be able to "refresh" the TUI. Basically abort the prompt and re-render/re-prompt with an updated state. A "Christmas came early" cherry on top solution could re-render lists while keeping state (search, maybe even 'selected item' using PartialEq or Hash?), but let's not get carried away.

Describe alternatives you've considered

I've tried emulating pressing an escape key and going from there, but am stuck so far

@mikaelmello
Copy link
Owner

Hey, sorry for the delay, just got back from vacation. This is a really important feature and allowing list refreshes on the fly is certainly something i want to implement before v1

@Baarsgaard
Copy link
Contributor

Baarsgaard commented Oct 1, 2023

I tried solving a similar problem by using the AutoComplete Trait that is available on the Text Prompt.

I was trying to make a Query builder for JQL(Jira Query Language) where the options would be completions provided by the Jira API, Which was possible, but I was querying the Jira API on any input that changed due to how get_suggestions and get_completion are called on any change to the input.
Which I attempted to solve by adding debounce logic, but that proved quite difficult.

My initial idea was a new Prompt named Query which accepts and show options similar to Select but allows to refresh the options similar to Text and it's AutoComplete trait.
But it could potentially be solved by expanding the AutoComplete trait with a refresh_options function and a config option to enable debouncing input.

@rchriste
Copy link
Contributor

rchriste commented Oct 2, 2024

This feature would also be useful for me. Right now, one of my menu options is a "Refresh List (Last Updated: [datetime])" menu option as a workaround.

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

4 participants