Toggle form fields based on condition #1663
Labels
api
Issues related to API
bug
Something isn't working
status: fixed in next release
The issue will be closed once next release is available
Description
When changing a string propery of an object in state, toggling the visibility of form fields based on this string does not behave correctly. I've used
useEffect
to know that the property in question is indeed chaning.Raycast version: 1.34.1
@Raycast/api version: 1.34.1
Steps To Reproduce
git clone -b rsync-commands-before-after [email protected]:maxfahl/raycast-extensions.git
cd raycast-extensions/extensions/rsync-commands
npm install
npm run dev
Rsync Commands
in RaycastSSH > "Source"
SSH > "Destination"
The toggle is being made on line
31
ofextensions/rsync-commands/src/components/entry-location-form-fields.tsx
. Adding auseEffect
withsshEnabled
as the dependency here shows that the value is indeed changing, but the view does not update when swapping from "Source" to "Destination" in the SSH field. There are two instances ofEntryLocationFormFields
rendered inextensions/rsync-commands/src/views/entry-form.tsx
, conditioned on thesshSelection
value of theentry
state object.If first selecting
SSH > "Source"
, you can make the fields go away from the source field set by selectingSSH > "None"
. When this is done you can successfully change toSSH > "Destination"
to see the SSH fields be positioned correctly.The text was updated successfully, but these errors were encountered: