Editing one policy parameter affects other displayed parameters #705
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix 695
Update input field to use useEffect to clear the input field when focus changes & keep placeholder in state so that it does not change when user deletes their entry.
input-policy-parameters.mp4
🤖 Generated by Copilot at 1e5792e
Summary
🧪🔎🔄
This pull request improves the user experience and testing of the
InputField
component, which allows users to edit policy parameters. It uses theuseSearchParams
hook to control the focus and clear the input based on the URL query, and updates the tests to mock this hook. It also adds auseEffect
hook to handle focus changes.Walkthrough
useSearchParams
hook toInputField
component and test file (link, link)useSearchParams
hook inInputField
test file and simulate different query parameters (link, link)InputField
test file in adescribe
block with a clear label (link)savedPlaceholder
state variable toInputField
component to store the initial placeholder prop (link)useEffect
hook toInputField
component to clear the input field and reset the placeholder when the focus changes (link)placeholder
prop withsavedPlaceholder
state variable ininput
element ofInputField
component (link)