Skip to content

Conversation

@rossnelson
Copy link
Collaborator

@rossnelson rossnelson commented Nov 24, 2025

Summary

Changes the search attributes form to disable (rather than hide) the delete button for existing attributes. Users can still add new rows and delete them if they haven't been saved to the server yet.

CleanShot 2025-11-24 at 16 54 43

CleanShot 2025-11-24 at 17 01 18

Changes

  • Removed hideDeleteButton prop from search attributes form components
  • Added isDeletable flag to SearchAttributeDefinition to track whether rows can be deleted
  • Delete button is now always visible but disabled for existing attributes
  • New attributes can be added and removed freely before saving
  • Updated Zod schema to include isDeletable field (defaults to true for new rows, false for existing)

Implementation Details

The isDeletable property uses positive logic:

  • isDeletable: true - Row can be deleted (new, unsaved rows)
  • isDeletable: false - Row cannot be deleted (existing, saved attributes)

This property must be included in the Zod schema to prevent SuperForms from stripping it during form state updates.

Behavior

  • Existing attributes: Delete button is disabled (isDeletable: false)
  • New empty rows: Delete button is enabled (isDeletable: true)
  • New named rows: Delete button is enabled until saved (isDeletable: true)
  • During submission: All delete buttons are disabled

Test Plan

  • Add a new search attribute row with empty name - verify delete button is enabled
  • Add a new search attribute with a name - verify delete button is enabled
  • Load existing search attributes - verify delete buttons are disabled for existing rows
  • Mix of existing and new rows - verify only new rows have enabled delete buttons
  • Add a new row and delete it - verify other delete buttons remain in correct state

- Remove hideDeleteButton prop from search attributes form components
- Add isExisting flag to SearchAttributeDefinition to track existing vs new rows
- Disable delete button for existing attributes while allowing deletion of newly added unsaved rows
- Update Zod schema to include optional isExisting field
@vercel
Copy link

vercel bot commented Nov 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
holocene Ready Ready Preview Comment Nov 25, 2025 7:41pm

isExisting is UI-only metadata and doesn't need validation
…Forms from stripping it

The root cause was SuperForms removing properties not defined in the validation schema.
By adding isExisting to the Zod schema with .optional().default(false), SuperForms
now preserves the flag correctly throughout the component lifecycle.
Rename property from isExisting to isDeletable with inverted logic for better semantic clarity. Now isDeletable: true means the row can be deleted (new rows) and isDeletable: false means it cannot be deleted (existing rows).
@rossnelson rossnelson marked this pull request as ready for review November 24, 2025 21:53
@rossnelson rossnelson requested a review from a team as a code owner November 24, 2025 21:53
…ults

Make isDeletable optional with a default value of true in the component props, removing the need to map over initial attributes to add the flag. Callers are now responsible for explicitly setting isDeletable: false on existing attributes.
@rossnelson rossnelson changed the title feat(search-attributes): disable delete button for existing attributes feat(search-attributes): add isDeleteable Nov 25, 2025
@rossnelson rossnelson changed the title feat(search-attributes): add isDeleteable feat(search-attributes): add isDeletable Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants