Skip to content

Commit

Permalink
remoteData attribute is, in fact, optional (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
chriszarate authored Oct 23, 2024
1 parent 2ab931b commit 79f4e7e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ export function FieldShortcodeSelectFieldPopover( props: FieldShortcodeSelectFie
</CardHeader>
<CardBody>
<FieldShortcodeSelectField
blockName={ props.fieldSelection.remoteData.blockName }
blockName={ props.fieldSelection.remoteData?.blockName ?? 'Remote Data Block' }
fieldType={ props.fieldSelection.type ?? 'field' }
onSelectField={ props.onSelectField }
queryInput={ props.fieldSelection.remoteData.queryInput }
queryInput={ props.fieldSelection.remoteData?.queryInput ?? {} }
selectedField={ props.fieldSelection.selectedField }
/>
</CardBody>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/block-binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function hasBlockBinding(
);
}

export function hasRemoteDataChanged( one: RemoteData, two: RemoteData ): boolean {
export function hasRemoteDataChanged( one?: RemoteData, two?: RemoteData ): boolean {
if ( ! one || ! two ) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion types/remote-data.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface RemoteData {
}

interface RemoteDataBlockAttributes {
remoteData: RemoteData;
remoteData?: RemoteData;
}

interface FieldSelection extends RemoteDataBlockAttributes {
Expand Down

0 comments on commit 79f4e7e

Please sign in to comment.