Skip to content

Commit

Permalink
fix: handle null LiteralMap in RemoteLiteralMapViewer
Browse files Browse the repository at this point in the history
flyteidl generated JS code uses null as a default value for non-primitive
objects.
  • Loading branch information
kanterov committed Nov 9, 2020
1 parent 6685288 commit cc8e66a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/Literals/RemoteLiteralMapViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const BlobTooLarge: React.FC<{ url: string }> = ({ url }) => (
*/
export const RemoteLiteralMapViewer: React.FC<{
blob: UrlBlob;
map?: LiteralMap;
map: LiteralMap | null;
}> = ({ blob, map }) => {
if (!blob.url || !blob.bytes) {
return (
Expand All @@ -38,7 +38,7 @@ export const RemoteLiteralMapViewer: React.FC<{
);
}

if (map !== undefined) {
if (map != null) {
return <LiteralMapViewer map={map} />;
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/Literals/test/RemoteLiteralMapViewer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('RemoteLiteralMapViewer', () => {
};

const { getAllByText } = render(
<RemoteLiteralMapViewer map={undefined} blob={blob} />
<RemoteLiteralMapViewer map={null} blob={blob} />
);

const items = getAllByText('No data is available.');
Expand All @@ -45,7 +45,7 @@ describe('RemoteLiteralMapViewer', () => {
expect(items.length).toBe(1);
});

it('fetches blob if map is undefined', () => {
it('fetches blob if map is null', () => {
const map: LiteralMap = {
literals: {
input1: {}
Expand All @@ -65,7 +65,7 @@ describe('RemoteLiteralMapViewer', () => {
};

const { getAllByText } = render(
<RemoteLiteralMapViewer map={undefined} blob={blob} />
<RemoteLiteralMapViewer map={null} blob={blob} />
);

const items = getAllByText('input1:');
Expand Down
4 changes: 2 additions & 2 deletions src/models/Execution/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,6 @@ export interface TaskExecutionClosure extends Admin.ITaskExecutionClosure {
export interface ExecutionData {
inputs: UrlBlob;
outputs: UrlBlob;
fullInputs?: LiteralMap;
fullOutputs?: LiteralMap;
fullInputs: LiteralMap | null;
fullOutputs: LiteralMap | null;
}

0 comments on commit cc8e66a

Please sign in to comment.