Skip to content

Commit 0947b3c

Browse files
baozhoutaoclaude
andauthored
fix(app-shell): lookup-param helpText only renders when the param actually degraded to a raw-id input (#3094) (#3095)
The action params dialog rendered `actionDialog.lookupHelpText` ("no reference object configured, picker unavailable, paste a record id") for EVERY lookup/reference param without a custom helpText — even when `reference` was configured and the record picker worked. The condition only checked "is a lookup param"; the degradation it describes lives in paramToField() (lookup + no referenceTo → text input) and was never consulted. Gate the message on `field.type === 'text'`, mirroring the adjacent lookupPlaceholder branch that already checks it. Tests pin all three states: working picker → no warning; targetless param → text input + warning; custom helpText → custom text wins. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 7f23cd0 commit 0947b3c

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

packages/app-shell/src/views/ActionParamDialog.test.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,28 @@ describe('ActionParamDialog — shared field-widget rendering (ADR-0059)', () =>
184184
await waitFor(() => expect(resolve).toHaveBeenCalledWith({ x: 'v' }));
185185
});
186186

187+
it('a lookup param WITH a reference target renders the picker without the degraded-lookup helpText (#3094)', async () => {
188+
openDialog([def({ name: 'manager', type: 'lookup', referenceTo: 'sys_user' })]);
189+
// The real picker widget mounts (its trigger button, behind Suspense)…
190+
expect(await screen.findByTestId('lookup-trigger-manager')).toBeTruthy();
191+
// …and the "no reference object configured" warning must NOT appear.
192+
expect(screen.queryByText('actionDialog.lookupHelpText')).toBeNull();
193+
});
194+
195+
it('a lookup param WITHOUT a reference target degrades to text and shows the degraded-lookup helpText', async () => {
196+
openDialog([def({ name: 'manager', type: 'lookup' })]);
197+
const input = await screen.findByLabelText('Param One');
198+
expect(input.getAttribute('type')).toBe('text');
199+
expect(await screen.findByText('actionDialog.lookupHelpText')).toBeTruthy();
200+
});
201+
202+
it('a degraded lookup param with a custom helpText shows that text instead of the built-in warning', async () => {
203+
openDialog([def({ name: 'manager', type: 'lookup', helpText: 'Paste the user id from the admin list' })]);
204+
await screen.findByLabelText('Param One');
205+
expect(await screen.findByText('Paste the user id from the admin list')).toBeTruthy();
206+
expect(screen.queryByText('actionDialog.lookupHelpText')).toBeNull();
207+
});
208+
187209
it('seeds defaultValue and returns it untouched on confirm', async () => {
188210
const resolve = openDialog([def({ name: 'note', type: 'text', defaultValue: 'seed' })]);
189211
const input = await screen.findByLabelText('Param One');

packages/app-shell/src/views/ActionParamDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export function ActionParamDialog({ state, onOpenChange }: ActionParamDialogProp
277277
{param.helpText && (
278278
<p className="text-xs text-muted-foreground">{param.helpText}</p>
279279
)}
280-
{isLookupParam && !param.helpText && (
280+
{isLookupParam && field.type === 'text' && !param.helpText && (
281281
<p className="text-xs text-muted-foreground">
282282
{t('actionDialog.lookupHelpText')}
283283
</p>

0 commit comments

Comments
 (0)