mirror of
https://github.com/wassname/talk.git
synced 2026-08-03 13:20:59 +08:00
Cleanup Relay Types
This commit is contained in:
Generated
+3
-8
@@ -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",
|
||||
|
||||
+1
-1
@@ -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",
|
||||
|
||||
@@ -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<V, R> {
|
||||
cacheConfig?: CacheConfig;
|
||||
query?: GraphQLTaggedNode | null;
|
||||
render(readyState: ReadyState<R>): React.ReactElement<any> | undefined | null;
|
||||
variables: V;
|
||||
rerunParamExperimental?: RerunParam;
|
||||
}
|
||||
|
||||
// Taken from relay types and added Generic support for Variables and Response
|
||||
export interface ReadyState<R> {
|
||||
error: Error | undefined | null;
|
||||
props: R | undefined | null;
|
||||
retry?(): void;
|
||||
}
|
||||
// Omit environment as we are passing this from the context.
|
||||
export type QueryRendererProps<V, R> = Omit<
|
||||
QueryRendererPropsOrig<V, R>,
|
||||
"environment"
|
||||
>;
|
||||
|
||||
/**
|
||||
* TalkQueryRenderer is a wrappper around Relay's `QueryRenderer`.
|
||||
|
||||
@@ -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<any>;
|
||||
pageInfo?: PageInfo;
|
||||
}
|
||||
|
||||
type ConnectionConfig<T> = Overwrite<
|
||||
OrigConnectionConfig<T>,
|
||||
{ getConnectionFromProps?(props: T): ConnectionData | undefined | null }
|
||||
>;
|
||||
|
||||
/**
|
||||
* withPaginationContainer is a curried version of `createPaginationContainers`
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user