Skip to content

feat(ENG-3987): move the connector profile picker into the hub form - #246

Open
brycetoz wants to merge 4 commits into
mainfrom
feat/hub-profile-picker-in-form
Open

brycetoz wants to merge 4 commits into
mainfrom
feat/hub-profile-picker-in-form

Conversation

@brycetoz

@brycetoz brycetoz commented Nov 9, 2026 •

Copy link
Copy Markdown

Summary

The form header was running out of room: the profile dropdown, the connector name, the guide icon and the close button all competed for one row, so the name was hidden below 420px and long profile names were cut off. This moves the profile picker out of the header and into the top of the form, as option A from the mockups in the Slack thread.

  • The header now shows only back, the connector name (ellipsis with a tooltip when it is too long), the guide and close.
  • The picker is a full-width Connection profile field above the auth fields, so it reads in the right order: profile, then auth method, then fields.
  • Each option uses the two-line layout from the connectors page: profile name on top, auth method underneath, and Default as a pill instead of the pipe-separated text.
  • A connector with only one profile shows no picker at all. There is nothing to choose, so the form starts straight at the fields.
  • The picker sits outside the keyed form view, so switching between profiles that have already loaded keeps it mounted and keeps keyboard focus on it. A switch to a profile whose config is still loading shows the loading view, the same as on main.

Closes ENG-3987. Follow-up ticket for review and finishing: ENG-4042.

Design signed off in the Slack thread on the video and screenshots below, with no divider needed between the picker and the fields. Screenshots recaptured on the review-round code; the demo video is from 457bc2d and looks the same.

Before and after

Profile chosen closed
Menu open menu
OAuth profile (no fields) oauth
360px panel narrow
Connector with 1 profile single

Demo

demo

Full quality mp4

The demo runs the built bundle against a mock API: Humaans has three profiles (API key, an API key profile with a data region field, OAuth), BambooHR has one.

Changes

  • components/ProfilePicker.tsx (new): renders the dropdown, or nothing when there are fewer than two profiles or the selected profile is not among them.
  • components/IntegrationPickerContent.tsx: renders the picker above the keyed IntegrationFormView, inside a column whose form region scrolls on its own.
  • components/cardTitle.tsx, components/IntegrationPickerTitle.tsx, IntegrationPicker.tsx: drop the header dropdown, its props and the container query that hid the name.
  • utils/profileOptions.tsx: auth method as the second line, Default as a pill; returns no options for a single profile.
  • hooks/useIntegrationPicker.ts: the form waits for the first profiles answer (not retries), so the picker never pushes the fields down.
  • shared/httpClient.ts, queries.ts: optional timeoutMs on requests (an AbortController timer); the profiles request uses 10s so a stalled call cannot hold the form on its loading state.

Testing

  • npm run lint (Biome and tsc --noEmit), npm test (50/50), npm run build, npm run verify:build: all pass on 083ec0a.
  • Checked by hand in the demo harness: fields profile, OAuth profile, profile with a select field, 360px panel, single profile connector, focus after switching profiles, a tall form (scrolls inside the form region, last field above Connect), profiles delayed 1.5s (loading, then picker and fields together at about 1575ms) and profiles stalled 60s (form opens at 10s without the picker).

Review round (jpmiguel)

Comment Outcome
Layout shift when profiles arrive after the form Fixed in 950eb18 and 083ec0a: form waits for the first profiles answer, with a 10s timeout
Blank trigger when the selected id is not in the list Fixed in 950eb18: picker hidden in that case
required used to hide "(Optional)" Fixed in 950eb18: requiredIndicator="none"
Empty auth label passed through Fixed in 950eb18: back to a truthy check, with a test
Use malachite Flex Not changed: Flex has no min-height, so a tall form overflows under the footer (measured). Comment added
Use malachite Padded Not changed: Padded is symmetric, so it doubles the gap to the first field. Comment added
Memoise items and callback Fixed in 950eb18

Gates

Gate Head Result
Repo skills none in repo
/forge 959fe39, 457bc2d applied
Security scan (diff-scoped) 959fe39 clean
/security-review 959fe39 clean
Codex security pass 950eb18 1 medium: stalled profiles request could hold the form on loading. Fixed in 083ec0a
Codex security pass 1cd3544 (amended into 083ec0a) 1 P2: AbortSignal.timeout missing in older Safari. Replaced with an AbortController timer
Correctness review 950eb18 same stall finding, fixed
Codex security pass 083ec0a clean

Security: no new HTML sinks; profile names and auth labels render as text. No token in logs.

Post-merge validation

  • After the next hub release, open a connector with several profiles in the dashboard hub: the picker sits above the fields, switching profiles keeps focus, and nothing shifts when the form appears.
  • Open a connector with one profile: no picker.
  • Watch for reports of the hub sitting on "Loading integration data"; the profiles call now gives up after 10s.

Requested by bryce@stackone.com in Slack.

🤖 Generated with Claude Code

s2d2-s1 and others added 2 commits November 9, 2026 09:43
The header no longer carries the profile dropdown: it keeps back, logo,
connector name, guide and close. The picker is now the first field of the
form, a two-line dropdown with the profile name and a Default pill on line
one and its auth method on line two. It is hidden when the connector has a
single profile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Bryce Tozer <188892020+brycetoz@users.noreply.github.com>
Render the picker above the keyed form view so choosing a profile does not
remount it, which dropped keyboard focus to the body.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Bryce Tozer <188892020+brycetoz@users.noreply.github.com>
@brycetoz brycetoz self-assigned this Nov 9, 2026
@brycetoz
brycetoz requested a review from jpmiguel November 9, 2026 11:40

@jpmiguel jpmiguel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code review (medium effort): 7 inline findings, most severe first.

setEditingSecrets={setEditingSecrets}
/>
<div style={FORM_LAYOUT_STYLE}>
<ProfilePicker

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Layout shift when profiles resolve after the form. profiles comes from a separate query (connectorProfiles, with its own retry config) that can settle after connectorData. Until then ProfilePicker renders null, so the form draws first and then gets pushed down by the ~70px picker row once the list arrives. A user who has already clicked into the first field sees it jump mid-typing. In the header this pop-in never moved the fields. Consider reserving the row (or showing a loading/disabled dropdown) while the profiles query is pending for a provider.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 950eb18 and 083ec0a. The form now waits for the first profiles answer (isLoadingProfiles && profilesFailureCount === 0 in useIntegrationPicker.ts), so the picker and the fields render in the same frame. It does not wait for retries, and 083ec0a gives the profiles request a 10s timeout (an AbortController timer in httpClient.ts) so a call that never answers fails and the form opens without the picker.

Checked in a local harness: with profiles delayed 1.5s the hub shows the loading state, then the picker and fields together at about 1550ms, with no shift. With profiles stalled for 60s the form opens at 10s.

subtitleLayout="stacked"
showSubtitleInTrigger
items={items}
value={selectedProfileId}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Blank required field if the selected id is not in the list. value={selectedProfileId} is selectedIntegration.integration_id, but the items come from the profiles endpoint. If the two disagree (for example account edit mode where selectedIntegration falls back to the provider match in useIntegrationPicker, or an inactive profile filtered out of the list), the controlled Dropdown matches no item and shows an empty trigger on a field labelled required. In the header this was a small chip; now it is the first form field. Worth falling back to the default profile or hiding the picker when the selection is not among the options.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 950eb18: ProfilePicker returns null when the selected id is not among the options, so the form never shows an empty trigger. I chose hiding over falling back to the default profile because switching profile changes the connection method; picking one silently in edit mode would change what the user is editing.

<Dropdown
name="connector-profile"
label="Connection profile"
required

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

required is used only to hide the "(Optional)" suffix, but it also marks the control as required for assistive tech and form semantics. malachite's Dropdown has requiredIndicator="none" (RequiredIndicator = 'optional-suffix' | 'asterisk' | 'none') for exactly this, so the intent is stated directly.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 950eb18: switched to requiredIndicator="none" and dropped required.

subtitle: profile.is_default ? 'Default' : undefined,
badge: profile.authentication_config_label ? (
<Tag type="default" fontSize="xsmall" value={profile.authentication_config_label} />
subtitle: profile.authentication_config_label ?? undefined,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The old code used a truthy check (profile.authentication_config_label ? ... : undefined); ?? undefined now passes an empty string through. An API that returns "" for the label gives a subtitle: '', which with showSubtitleInTrigger and subtitleLayout="stacked" may render an empty second line. profile.authentication_config_label || undefined keeps the old behaviour. No test covers the empty-label case.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 950eb18: back to profile.authentication_config_label || undefined, with a test for the empty label (leaves out an empty auth method label in profileOptions.test.tsx).

import { SuccessView } from './views/SuccessView';

// The picker sits outside the keyed form so a profile switch does not remount it and drop its focus.
const FORM_LAYOUT_STYLE: React.CSSProperties = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reuse: these inline style objects rebuild what malachite's Flex already does (direction={FlexDirection.Vertical} with fullHeight), which is how the rest of the integration picker lays things out (IntegrationFields.tsx, cardTitle.tsx). Switching to Flex drops both style constants.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Tried this and reverted it. malachite Flex can set flex: 1 (grow) and min-width: 0 (shrink) but never min-height, so the form region grows to its content instead of shrinking below it. With a tall form (I added 8 optional fields in the harness) the outer container scrolls and the last field ends up under the footer. With the inline flex: 1; min-height: 0 there is one scroller inside the form region and the last input sits above Connect (measured: last input bottom 527px, Connect top 583px). I added a comment on the region style saying why it stays.

import { ConnectorProfile } from '../types';
import { profileOptions } from '../utils/profileOptions';

const PICKER_STYLE: React.CSSProperties = { padding: '28px 14px 0' };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reuse: 28px 14px are exactly malachite Padded's large and medium values, the ones the form below uses (<Padded vertical="large" horizontal="medium">). Hardcoding them means the picker drifts from the form's gutter if the tokens change. Prefer Padded (or a shared constant) so the picker and the fields stay aligned.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Kept the inline padding, with a comment. Padded applies one value to top and bottom (padding: ${vertical} ${horizontal}), and the picker needs the form's 28px top gutter with no bottom; vertical="large" would add 28px under the picker on top of the form's own 28px, doubling the gap to the first field. If malachite gets per-side padding I'm happy to switch.

selectedProfileId,
onProfileChange,
}) => {
const items = profileOptions(profiles);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Efficiency: IntegrationPickerContent re-renders on every keystroke because formData lives in the parent hook, and each render rebuilds the items array (with new Tag elements) and a new onItemSelected closure, so the Dropdown re-renders too. useMemo(() => profileOptions(profiles), [profiles]) and a stable callback avoid this. Minor, but this component now sits in the form's render path.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 950eb18: useMemo for the items and useCallback for onItemSelected.

s2d2-s1 and others added 2 commits November 16, 2026 11:50
- Hold the form until the first profiles answer so the picker never
  pushes the fields down; a failing profiles call does not wait on retries.
- Hide the picker when the selected profile is not in the list.
- Use requiredIndicator="none" instead of required.
- Drop an empty auth method label instead of rendering a blank line.
- Memoise the options and the select handler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Bryce Tozer <188892020+brycetoz@users.noreply.github.com>
…opens

The form waits for the first profiles answer. Without a timeout a request
that never answers kept the hub on its loading state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Bryce Tozer <188892020+brycetoz@users.noreply.github.com>
@brycetoz
brycetoz requested a review from jpmiguel November 18, 2026 12:07
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.

3 participants