Skip to content

Commit 505d409

Browse files
committed
fix(fields): the name-only reference value's type comes from the spec export
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbahxR9HAJnTs7UKhmn
1 parent 572533a commit 505d409

1 file changed

Lines changed: 12 additions & 17 deletions

File tree

‎ui/packages/fields/src/index.tsx‎

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { ComponentRegistry, percentDisplayValue, type PercentScale, getRecordDis
1515
// `resolveFieldScale` is the same kind of ask: the width an ABSENT `scale`
1616
// means is the protocol's answer, not this package's (objectui#9843).
1717
import { valueSchemaFor, resolveFieldScale } from '@objectstack/spec/data';
18+
import type { ReferenceNameOnlyValue } from '@objectstack/spec/data';
1819
import { useLocalization, useDisplayLocale, formatDisplayNumber } from '@object-ui/i18n';
1920
import { Badge, Avatar, AvatarImage, AvatarFallback, Button, Checkbox, EmptyValue, cn, setFieldReadFaceResolver } from '@object-ui/components';
2021
import { Check, Copy, Phone as PhoneIcon, MapPin, CircleQuestionMark, Lock, Star } from 'lucide-react';
@@ -3240,23 +3241,17 @@ function RestrictedLookupReference({ label }: { label: string }): React.ReactEle
32403241
}
32413242

32423243
/**
3243-
* The value a `lookup` / `user` field declaring `referenceNameVisible: true`
3244-
* is served on `$expand` when the reader may read the record carrying it but
3245-
* is refused the record it points at (director ruling 6574398310, letter B):
3246-
* the id the row holds, the target's display name, and the refusal said in
3247-
* the value. The server's own type is `ReferenceNameOnlyValue` in
3248-
* `@objectstack/objectql` (`engine-reference-name-visible.ts`); it is served
3249-
* once per element on a `multiple: true` field. `name` is the target's
3250-
* ADR-0079 display name, or the floor `Record #<id>` when a field-level rule
3251-
* on the name column holds it back, and is drawn exactly as served.
3252-
*/
3253-
interface ReferenceNameOnlyValue {
3254-
id: string;
3255-
name: string;
3256-
readRefused: true;
3257-
}
3258-
3259-
/**
3244+
* `ReferenceNameOnlyValue` (imported from `@objectstack/spec/data`, where
3245+
* `ReferenceNameOnlyValueSchema` owns the shape and the engine imports the same
3246+
* type) is the value a `lookup` / `user` field declaring
3247+
* `referenceNameVisible: true` is served on `$expand` when the reader may read
3248+
* the record carrying it but is refused the record it points at (director
3249+
* ruling 6574398310, letter B): the id the row holds, the target's display
3250+
* name, and the refusal said in the value, once per element on a
3251+
* `multiple: true` field. `name` is the target's ADR-0079 display name, or the
3252+
* floor `Record #<id>` when a field-level rule on the name column holds it
3253+
* back, and is drawn exactly as served.
3254+
*
32603255
* Is this one reference value the served name-only form? Judged on the
32613256
* in-band `readRefused: true` the server writes, never on the shape of the
32623257
* rest: an expanded record the reader may read can also carry just an id and

0 commit comments

Comments
 (0)