Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/base/card-api.gts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export {
getFieldDescription,
getFields,
getRelationship,
isNonPresentLink,
peekAtField,
isCard,
isField,
Expand Down Expand Up @@ -1245,7 +1246,11 @@ class LinksTo<CardT extends LinkableDefConstructor> implements Field<CardT> {
}
let value = getter(instance, this);
trackRuntimeRelationshipDependency(value, this.card);
return value;
// An unset linksTo falls through to LinksTo.emptyValue() which returns
// `null`; the userland contract is that every non-present state — including
// not-set — surfaces as `undefined`, so all four non-present discriminants
// collapse to one nullish shape.
return value ?? undefined;
}

queryableValue(instance: any, stack: CardDef[]): any {
Expand Down
8 changes: 4 additions & 4 deletions packages/host/app/lib/gc-card-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1032,10 +1032,10 @@ function findInstances(
if (isFileDefInstance(obj)) {
return [obj];
}
if (
(obj as { type?: unknown; reference?: unknown }).type === 'not-loaded' &&
typeof (obj as { reference?: unknown }).reference === 'string'
) {
// A sentinel in the bucket (not-loaded / link-error / link-not-found) is
// never an instance and never owns instance references — skip the recursion
// so its `errorDoc` and `reference` fields are not walked as a generic object.
if (api.isNonPresentLink(obj)) {
return [];
}
if (isBaseDefInstance(obj)) {
Expand Down
Loading
Loading