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

Toggle form fields based on condition #1663

Closed
maxfahl opened this issue May 11, 2022 · 0 comments
Closed

Toggle form fields based on condition #1663

maxfahl opened this issue May 11, 2022 · 0 comments
Assignees
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

Comments

@maxfahl
Copy link
Contributor

maxfahl commented May 11, 2022

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

  1. git clone -b rsync-commands-before-after [email protected]:maxfahl/raycast-extensions.git
  2. cd raycast-extensions/extensions/rsync-commands
  3. npm install
  4. npm run dev
  5. Run Rsync Commands in Raycast
  6. Create new entry
  7. Select SSH > "Source"
  8. Swap to SSH > "Destination"
  9. The SSH fields under source field set are still visible, and no SSH fields are visible under the destination field set.

The toggle is being made on line 31 of extensions/rsync-commands/src/components/entry-location-form-fields.tsx. Adding a useEffect with sshEnabled 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 of EntryLocationFormFields rendered in extensions/rsync-commands/src/views/entry-form.tsx, conditioned on the sshSelection value of the entry state object.

If first selecting SSH > "Source", you can make the fields go away from the source field set by selecting SSH > "None". When this is done you can successfully change to SSH > "Destination" to see the SSH fields be positioned correctly.

@maxfahl maxfahl added api Issues related to API bug Something isn't working labels May 11, 2022
@sxn sxn self-assigned this May 11, 2022
@fe9lix fe9lix added the status: fixed in next release The issue will be closed once next release is available label May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

4 participants