Skip to content

Toggle form fields based on condition #1663

Closed

Description

@maxfahl

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.

Activity

  1. added
    api
    bug
    on May 11, 2022
  2. self-assigned this
    on May 11, 2022
  3. added
    status: fixed in next release
    on May 12, 2022
  4. added a commit that references this issue on Mar 20, 2026
  5. added a commit that references this issue on Oct 14, 2026
  6. added a commit that references this issue on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

apibugstatus: fixed in next release

Type

No type

Fields

Priority

None yet

Severity

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions