question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic commands based on user input

See original GitHub issue

Is your feature request related to a problem? Please describe. Currently I’m unable to generate commands dynamically based on the user’s query. For example, when the user types “my query”, I would like to include commands Search for "my query" and Create file named "myQuery.txt".

Describe the solution you’d like Ideally we’d have a mechanism to access the <input>'s value. A solution that comes to mind is allowing the commands prop to also accept a (query: string) => object[] callback, passing the user’s query as an argument.

Describe alternatives you’ve considered Another solution could be exposing an inputRef prop which gets forwarded the <input> element, thus allowing the parent component to access the query directly via inputRef.current.value. I dislike this approach as it exposes implementation details about the component. The input field will probably always be a bona fide <input>, but still, providing the query via a callback seems superior.

I could probably use findDOMNode to get a reference to the <input> and regenerate the command array when the query changes, but obviously this is hacky and sad.

Happy to work on this. Or if this is possible already and I’m simply missing it, would love to know it.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
asabayluscommented, Dec 31, 2019

@mminer youre right, I’m working on adding a defaultInputValue and some associated changes that will fix this issue.

0reactions
asabayluscommented, Jan 19, 2020

Added a userQuery arg to onChange which resolves this issue in v0.9.9-0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: Dynamically write query based on User Input in App
I do this with dynamic input in-db. Basically have your query in a text input and have the action tool change/add whatever dependencies...
Read more >
Bash script prompt to run dynamic set of commands
If you took user input into a series of variables (using the read command as detailed in the other answer), one for each...
Read more >
How to enable or disable dynamic input and command prompt ...
Issue: How to enable or disable the dynamic input and command prompt that are seen at the crosshairs when drawing in AutoCAD.
Read more >
Commands with user input (a.k.a. "arguments")
It's a common case with a simple solution. This section will teach you how to extract user input from a message and use...
Read more >
what command or box do i use to get a dynamic input box on ...
If you do not have a maximum number of sensors that the user can enter, then you need to design in some kind...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found