mirror of
https://github.com/wassname/talk.git
synced 2026-07-06 05:17:19 +08:00
Mark comments as always returning a value
This commit is contained in:
+1
-1
@@ -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",
|
||||
|
||||
@@ -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(<Stream {...props} />);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
describe("when there is more", () => {
|
||||
const props = {
|
||||
assetID: "asset-id",
|
||||
|
||||
@@ -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<StreamProps> = props => {
|
||||
if (props.comments === null) {
|
||||
// TODO: (@cvle) What's the reason for this being null?
|
||||
return <div>Comments unavailable</div>;
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<Logo gutterBottom />
|
||||
|
||||
@@ -22,9 +22,7 @@ export class StreamContainer extends React.Component<InnerProps> {
|
||||
};
|
||||
|
||||
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 (
|
||||
<Stream
|
||||
assetID={this.props.asset.id}
|
||||
|
||||
@@ -305,7 +305,7 @@ type Asset {
|
||||
first: Int = 10
|
||||
orderBy: COMMENT_SORT = CREATED_AT_DESC
|
||||
after: Cursor
|
||||
): CommentsConnection
|
||||
): CommentsConnection!
|
||||
|
||||
"""
|
||||
author is the authors listed in the meta tags for the Asset.
|
||||
|
||||
Reference in New Issue
Block a user