Skip to content

Conversation

@qstearns
Copy link
Contributor

@qstearns qstearns commented Nov 10, 2025

Adds an option to supply a create callback to the combo box which allows you to create an item that you supply

image

Note

Adds a createOptions API to Combobox to create a new option from the current search, with an example Storybook story.

  • Components:
    • src/components/Combobox/index.tsx
      • Add createOptions prop with handleCreate(search) and optional renderCreatePrompt(search).
      • Render a "Create …" CommandItem when search is non-empty, invoking handleCreate.
  • Storybook:
    • src/components/Combobox/index.stories.tsx
      • Add WithCreateOption story demonstrating dynamic option creation using useState.

Written by Cursor Bugbot for commit 44bab5c. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bug: Conflicting UI elements in empty search state.

When no filtered items match the search but createOptions is provided, both the "No option found" message and the create option are displayed simultaneously. The empty state message should be suppressed when the create option is available and there's search text, as the create option provides a valid action.

src/components/Combobox/index.tsx#L163-L165

<CommandItem disabled>{errorText}</CommandItem>
) : filteredItems.length === 0 ? (
<CommandItem disabled>{emptyText}</CommandItem>

Fix in Cursor Fix in Web


const { renderCreatePrompt, handleCreate } = createOptions
return (
<CommandGroup>
<CommandItem onSelect={() => handleCreate(search)}>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Ensure consistent popover behavior on creation.

When the create option is selected, the popover remains open and the search text isn't cleared. This differs from selecting a regular option, which closes the popover and clears the search via handleSelect. The handleCreate callback should trigger the same cleanup behavior for consistent UX.

Fix in Cursor Fix in Web

qstearns added a commit to speakeasy-api/gram that referenced this pull request Nov 12, 2025
Allows attaching environments to sources for all callers.

This introduces the distinction between a System Environment and User
Configuration to the system. These names might be stupid but they
attempt to get around the idea that Headers are more of an
implementation detail and the rules associated with how you merge these
things should be derived from their provenance rather than how they were
supplied.

We make some decisions. First off, we complect the call sites of tool
proxies by placing the onus of loading on them. This was more or less in
the name of purity of the tools proxy. But might be a mistake because it
forces the onus of reading system environments to a bunch of places in
our code base. It's possible it's a little bug-prone to do this nonsense
in a bunch of places.

The other decision, which I feel a little better about is to provide
both environments to each tool type and leave the responsibility of
merging them at the call site. Even though we aim for consistent
behavior (ie. preferring user config over system environment), leaving
the flexibility on how to merge each tool type seems healthy.

## UX

A dialog attached to source cards. Not good.

Affordance to access functionality is currently buried behind:

<img width="720" height="391" alt="image"
src="https://github.com/user-attachments/assets/fce5cd45-7b45-4485-a26a-346c44e817a5"
/>

The interface for attaching an environment is implemented in this modal:

<img width="779" height="356" alt="image"
src="https://github.com/user-attachments/assets/89de283e-d412-44a8-b15b-276002762419"
/>

* We use a combobox
* We try to preview what variables will be set to make more mistakes
more obvious
* Currently pretty ugly, but banking on the UX moving to a new location
shortly before I figure out a good hierarchy for presenting. Happy to
knock any quick fixes to make this present better if people feel
strongly

## Things to pay Attention To

* Moved sources components to new directory, but also changed the modal
paradigm (separate content components, used `zustand` for state
management)
* I ported all of the `Dialog`s and Dropdown Menu's to the moonshine
versions of those components. I couldn't visually tell the difference
and there were some really nasty interplay issues. Hoping this is a nice
stability move

## Considerations

* Might consider adding a confirmation button considering this action is
a pretty serious one
* UX is quite ugly at the moment. Preferring to follow up with a
dedicated sources page instead of burying behind a dialog
* Blocked on this moonshine PR:
speakeasy-api/moonshine#319
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