Skip to content

Commit

Permalink
Records can have null fields. (#2875)
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskerr authored Nov 2, 2023
1 parent 06ce522 commit b90a400
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions apps/zui/src/app/features/inspector/views/record-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class RecordView extends ContainerView<zed.Record> {
}

count() {
return this.value.fields.length
return this.value.fields?.length || 0
}

openToken() {
Expand All @@ -20,7 +20,7 @@ export class RecordView extends ContainerView<zed.Record> {
}

*iterate(n?: number) {
const fields = this.value.fields
const fields = this.value.fields || []
const length = n ? Math.min(n, fields.length) : fields.length

for (let i = 0; i < fields.length; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion packages/zed-js/src/values/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class Record implements Value {
}

isUnset() {
return this.fields === null;
return false;
}

toJS(opts: JSOptions = {}) {
Expand Down

0 comments on commit b90a400

Please sign in to comment.