From ec1eff2b9d21b7eb0de409627df67a5e488a0da8 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 10 Jul 2018 19:14:42 -0300 Subject: [PATCH] Mark comments as always returning a value --- config/watcher.ts | 2 +- src/core/client/stream/components/Stream.spec.tsx | 13 ------------- src/core/client/stream/components/Stream.tsx | 6 +----- .../client/stream/containers/StreamContainer.tsx | 4 +--- src/core/server/graph/tenant/schema/schema.graphql | 2 +- 5 files changed, 4 insertions(+), 23 deletions(-) diff --git a/config/watcher.ts b/config/watcher.ts index 9ff074e51..89da62bf6 100644 --- a/config/watcher.ts +++ b/config/watcher.ts @@ -13,7 +13,7 @@ const config: Config = { "core/client/stream/**/*.ts", "core/client/stream/**/*.tsx", "core/client/stream/**/*.graphql", - "core/client/server/**/*.graphql", + "core/server/**/*.graphql", ], ignore: [ "core/**/*.d.ts", diff --git a/src/core/client/stream/components/Stream.spec.tsx b/src/core/client/stream/components/Stream.spec.tsx index 5d9c81bdf..05d30d66e 100644 --- a/src/core/client/stream/components/Stream.spec.tsx +++ b/src/core/client/stream/components/Stream.spec.tsx @@ -18,19 +18,6 @@ it("renders correctly", () => { expect(wrapper).toMatchSnapshot(); }); -it("renders when comments is null", () => { - const props = { - assetID: "asset-id", - isClosed: false, - comments: null, - onLoadMore: noop, - disableLoadMore: false, - hasMore: false, - }; - const wrapper = shallow(); - expect(wrapper).toMatchSnapshot(); -}); - describe("when there is more", () => { const props = { assetID: "asset-id", diff --git a/src/core/client/stream/components/Stream.tsx b/src/core/client/stream/components/Stream.tsx index 87f0670dd..a14816453 100644 --- a/src/core/client/stream/components/Stream.tsx +++ b/src/core/client/stream/components/Stream.tsx @@ -12,17 +12,13 @@ import Logo from "./Logo"; export interface StreamProps { assetID: string; isClosed: boolean; - comments: ReadonlyArray<{ id: string }> | null; + comments: ReadonlyArray<{ id: string }>; onLoadMore: () => void; hasMore: boolean; disableLoadMore: boolean; } const Stream: StatelessComponent = props => { - if (props.comments === null) { - // TODO: (@cvle) What's the reason for this being null? - return
Comments unavailable
; - } return (
diff --git a/src/core/client/stream/containers/StreamContainer.tsx b/src/core/client/stream/containers/StreamContainer.tsx index 9f13938b4..d81319deb 100644 --- a/src/core/client/stream/containers/StreamContainer.tsx +++ b/src/core/client/stream/containers/StreamContainer.tsx @@ -22,9 +22,7 @@ export class StreamContainer extends React.Component { }; public render() { - const comments = this.props.asset.comments - ? this.props.asset.comments.edges.map(edge => edge.node) - : null; + const comments = this.props.asset.comments.edges.map(edge => edge.node); return (