mirror of
https://github.com/wassname/talk.git
synced 2026-09-10 12:43:11 +08:00
Update relay-runtime types
This commit is contained in:
@@ -2,9 +2,9 @@ import * as React from "react";
|
||||
import { StatelessComponent } from "react";
|
||||
|
||||
import { Flex } from "talk-ui/components";
|
||||
|
||||
import PermalinkViewQuery from "../queries/PermalinkViewQuery";
|
||||
import StreamQuery from "../queries/StreamQuery";
|
||||
|
||||
import * as styles from "./App.css";
|
||||
|
||||
export interface AppProps {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Localized } from "fluent-react/compat";
|
||||
import React from "react";
|
||||
|
||||
import { oncePerFrame } from "talk-common/utils";
|
||||
import {
|
||||
Button,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { Component } from "react";
|
||||
import React, { Component, ReactNode } from "react";
|
||||
|
||||
import { BadUserInputError } from "talk-framework/lib/errors";
|
||||
import { PropTypesOf } from "talk-framework/types";
|
||||
@@ -11,6 +11,7 @@ import { CreateCommentMutation, withCreateCommentMutation } from "../mutations";
|
||||
interface InnerProps {
|
||||
createComment: CreateCommentMutation;
|
||||
assetID: string;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
class PostCommentFormContainer extends Component<InnerProps> {
|
||||
|
||||
@@ -23,7 +23,7 @@ export class ReplyListContainer extends React.Component<InnerProps> {
|
||||
|
||||
public render() {
|
||||
if (
|
||||
!this.props.comment.replies == null ||
|
||||
this.props.comment.replies == null ||
|
||||
this.props.comment.replies.edges.length === 0
|
||||
) {
|
||||
return null;
|
||||
|
||||
@@ -20,6 +20,7 @@ it("renders correctly", () => {
|
||||
edges: [{ node: { id: "comment-1" } }, { node: { id: "comment-2" } }],
|
||||
},
|
||||
},
|
||||
user: null,
|
||||
relay: {
|
||||
hasMore: noop,
|
||||
isLoading: noop,
|
||||
@@ -39,6 +40,7 @@ describe("when has more comments", () => {
|
||||
edges: [{ node: { id: "comment-1" } }, { node: { id: "comment-2" } }],
|
||||
},
|
||||
},
|
||||
user: null,
|
||||
relay: {
|
||||
hasMore: () => true,
|
||||
isLoading: () => false,
|
||||
|
||||
@@ -9,13 +9,10 @@ import {
|
||||
} from "talk-framework/lib/relay";
|
||||
import { Omit } from "talk-framework/types";
|
||||
|
||||
import {
|
||||
CreateCommentMutationResponse,
|
||||
CreateCommentMutationVariables,
|
||||
} from "talk-stream/__generated__/CreateCommentMutation.graphql";
|
||||
import { CreateCommentMutation } from "talk-stream/__generated__/CreateCommentMutation.graphql";
|
||||
|
||||
export type CreateCommentInput = Omit<
|
||||
CreateCommentMutationVariables["input"],
|
||||
CreateCommentMutation["variables"]["input"],
|
||||
"clientMutationId"
|
||||
>;
|
||||
|
||||
@@ -26,8 +23,12 @@ const mutation = graphql`
|
||||
cursor
|
||||
node {
|
||||
id
|
||||
...CommentContainer
|
||||
...ReplyListContainer_comment
|
||||
author {
|
||||
id
|
||||
username
|
||||
}
|
||||
body
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
clientMutationId
|
||||
@@ -40,10 +41,7 @@ let clientMutationId = 0;
|
||||
function commit(environment: Environment, input: CreateCommentInput) {
|
||||
const me = getMe(environment)!;
|
||||
const currentDate = new Date().toISOString();
|
||||
return commitMutationPromiseNormalized<
|
||||
CreateCommentMutationResponse["createComment"],
|
||||
CreateCommentMutationVariables
|
||||
>(environment, {
|
||||
return commitMutationPromiseNormalized<CreateCommentMutation>(environment, {
|
||||
mutation,
|
||||
variables: {
|
||||
input: {
|
||||
@@ -63,14 +61,6 @@ function commit(environment: Environment, input: CreateCommentInput) {
|
||||
username: me.username,
|
||||
},
|
||||
body: input.body,
|
||||
replies: {
|
||||
edges: [],
|
||||
pageInfo: {
|
||||
endCursor: null,
|
||||
hasNextPage: false,
|
||||
},
|
||||
},
|
||||
__typename: "Comment",
|
||||
},
|
||||
},
|
||||
clientMutationId: (clientMutationId++).toString(),
|
||||
@@ -100,4 +90,4 @@ export const withCreateCommentMutation = createMutationContainer(
|
||||
|
||||
export type CreateCommentMutation = (
|
||||
input: CreateCommentInput
|
||||
) => Promise<CreateCommentMutationResponse["createComment"]>;
|
||||
) => Promise<CreateCommentMutation["response"]["createComment"]>;
|
||||
|
||||
Reference in New Issue
Block a user