diff --git a/package-lock.json b/package-lock.json index 6038504da..ad599b648 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1628,14 +1628,9 @@ } }, "@types/react-relay": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/@types/react-relay/-/react-relay-1.3.6.tgz", - "integrity": "sha512-X0qv3nGlE4TStFLLKxgj+6MgHZEExB1N/RDcVcyCauAojV5byD0c6VhuqAluYaTKaL2FBuxdtDL405IhIIjEbQ==", - "dev": true, - "requires": { - "@types/react": "*", - "@types/relay-runtime": "*" - } + "version": "github:coralproject/patched#ba4c8d01bb737e5f073534b32d870294e39cc5a8", + "from": "github:coralproject/patched#types/react-relay", + "dev": true }, "@types/recompose": { "version": "0.26.1", diff --git a/package.json b/package.json index 707d65836..c6f02b53d 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "@types/passport": "^0.4.5", "@types/query-string": "^6.1.0", "@types/react-dom": "^16.0.6", - "@types/react-relay": "^1.3.6", + "@types/react-relay": "github:coralproject/patched#types/react-relay", "@types/recompose": "^0.26.1", "@types/relay-runtime": "github:coralproject/patched#types/relay-runtime", "@types/uuid": "^3.4.3", diff --git a/src/core/client/framework/lib/relay/QueryRenderer.tsx b/src/core/client/framework/lib/relay/QueryRenderer.tsx index 30a42dbe0..a5845c0b6 100644 --- a/src/core/client/framework/lib/relay/QueryRenderer.tsx +++ b/src/core/client/framework/lib/relay/QueryRenderer.tsx @@ -1,24 +1,18 @@ import React, { Component } from "react"; -import { QueryRenderer } from "react-relay"; -import { CacheConfig, GraphQLTaggedNode, RerunParam } from "relay-runtime"; +import { + QueryRenderer, + QueryRendererProps as QueryRendererPropsOrig, +} from "react-relay"; + +import { Omit } from "talk-framework/types"; import { TalkContextConsumer } from "../bootstrap/TalkContext"; -// Taken from relay types and added Generic support for Variables and Response -export interface QueryRendererProps { - cacheConfig?: CacheConfig; - query?: GraphQLTaggedNode | null; - render(readyState: ReadyState): React.ReactElement | undefined | null; - variables: V; - rerunParamExperimental?: RerunParam; -} - -// Taken from relay types and added Generic support for Variables and Response -export interface ReadyState { - error: Error | undefined | null; - props: R | undefined | null; - retry?(): void; -} +// Omit environment as we are passing this from the context. +export type QueryRendererProps = Omit< + QueryRendererPropsOrig, + "environment" +>; /** * TalkQueryRenderer is a wrappper around Relay's `QueryRenderer`. diff --git a/src/core/client/framework/lib/relay/withPaginationContainer.ts b/src/core/client/framework/lib/relay/withPaginationContainer.ts index a5d8e1231..0d01887b5 100644 --- a/src/core/client/framework/lib/relay/withPaginationContainer.ts +++ b/src/core/client/framework/lib/relay/withPaginationContainer.ts @@ -1,23 +1,10 @@ import { - ConnectionConfig as OrigConnectionConfig, + ConnectionConfig, createPaginationContainer, GraphQLTaggedNode, - PageInfo, RelayPaginationProp, } from "react-relay"; import { InferableComponentEnhancerWithProps } from "recompose"; -import { Overwrite } from "talk-framework/types"; - -// TODO: (cvle) Fix this type definition upstream. -interface ConnectionData { - edges?: Readonly; - pageInfo?: PageInfo; -} - -type ConnectionConfig = Overwrite< - OrigConnectionConfig, - { getConnectionFromProps?(props: T): ConnectionData | undefined | null } ->; /** * withPaginationContainer is a curried version of `createPaginationContainers` diff --git a/src/core/client/stream/containers/StreamContainer.tsx b/src/core/client/stream/containers/StreamContainer.tsx index 2ef8d72b5..63920a410 100644 --- a/src/core/client/stream/containers/StreamContainer.tsx +++ b/src/core/client/stream/containers/StreamContainer.tsx @@ -49,9 +49,9 @@ const enhanced = withPaginationContainer<{ asset: Data }, InnerProps>( asset: graphql` fragment StreamContainer_asset on Asset @argumentDefinitions( - count: { type: "Int", defaultValue: 5 } + count: { type: "Int!", defaultValue: 5 } cursor: { type: "Cursor" } - orderBy: { type: "COMMENT_SORT", defaultValue: CREATED_AT_DESC } + orderBy: { type: "COMMENT_SORT!", defaultValue: CREATED_AT_DESC } ) { id isClosed diff --git a/src/core/client/stream/queries/AppQuery.tsx b/src/core/client/stream/queries/AppQuery.tsx index 4dc61115c..96d260568 100644 --- a/src/core/client/stream/queries/AppQuery.tsx +++ b/src/core/client/stream/queries/AppQuery.tsx @@ -1,10 +1,10 @@ import * as React from "react"; import { StatelessComponent } from "react"; +import { ReadyState } from "react-relay"; import { graphql, QueryRenderer, - ReadyState, withLocalStateContainer, } from "talk-framework/lib/relay"; import {