Skip to content

Commit

Permalink
add fixme note
Browse files Browse the repository at this point in the history
  • Loading branch information
a-type committed Jan 19, 2025
1 parent 21897a2 commit 03db3f3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/store/src/entities/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
getChildFieldSchema,
getDefault,
hasDefault,
isFileRef,
isFile,
isFileRef,
isNullable,
isObject,
isRef,
Expand All @@ -29,6 +29,8 @@ import { processValueFiles } from '../files/utils.js';
import { EntityFile } from '../index.js';
import { EntityCache } from './EntityCache.js';
import { EntityFamilyMetadata, EntityMetadataView } from './EntityMetadata.js';
import { EntityStoreEventData, EntityStoreEvents } from './EntityStore.js';
import { entityFieldSubscriber } from './entityFieldSubscriber.js';
import {
BaseEntityValue,
DataFromInit,
Expand All @@ -39,8 +41,6 @@ import {
ListItemValue,
ObjectEntity,
} from './types.js';
import { EntityStoreEventData, EntityStoreEvents } from './EntityStore.js';
import { entityFieldSubscriber } from './entityFieldSubscriber.js';

export interface EntityInit {
oid: ObjectIdentifier;
Expand Down Expand Up @@ -657,6 +657,10 @@ export class Entity<
})
) {
if (hasDefault(fieldSchema)) {
// FIXME: this returns []/{} for arrays and objects, but the contract
// of this method should return an Entity for such object fields.
// I want to write a test case for this one before attempting to fix
// just to be sure the fix works.
return getDefault(fieldSchema);
}
if (isNullable(fieldSchema)) {
Expand Down

0 comments on commit 03db3f3

Please sign in to comment.