Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Full dep/devDep updates to latest versions #2873

Merged
merged 5 commits into from
Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,441 changes: 263 additions & 1,178 deletions package-lock.json

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,68 +107,68 @@
},
"sideEffects": false,
"devDependencies": {
"@types/enzyme": "3.1.17",
"@types/enzyme": "3.9.0",
"@types/enzyme-adapter-react-16": "1.0.5",
"@types/graphql": "14.0.7",
"@types/hoist-non-react-statics": "3.0.1",
"@types/hoist-non-react-statics": "3.3.0",
"@types/invariant": "2.2.29",
"@types/jest": "24.0.9",
"@types/jest": "24.0.11",
"@types/lodash.isequal": "4.5.5",
"@types/object-assign": "4.0.30",
"@types/prop-types": "15.7.0",
"@types/react": "16.4.18",
"@types/react-dom": "16.8.0",
"@types/react-test-renderer": "16.8.0",
"@types/recompose": "0.30.3",
"@types/react": "16.8.8",
"@types/react-dom": "16.8.2",
"@types/react-test-renderer": "16.8.1",
"@types/recompose": "0.30.5",
"@types/zen-observable": "0.8.0",
"apollo-cache": "1.2.1",
"apollo-cache-inmemory": "1.5.1",
"apollo-client": "2.5.1",
"apollo-link": "1.2.9",
"apollo-link": "1.2.11",
"babel-core": "6.26.3",
"babel-jest": "24.1.0",
"babel-jest": "24.5.0",
"babel-preset-env": "1.7.0",
"bundlesize": "0.17.1",
"coveralls": "3.0.3",
"danger": "7.0.14",
"enzyme": "3.8.0",
"enzyme-adapter-react-16": "1.10.0",
"danger": "7.0.15",
"enzyme": "3.9.0",
"enzyme-adapter-react-16": "1.11.2",
"graphql": "14.1.1",
"graphql-tag": "2.10.1",
"jest": "24.1.0",
"jest-junit": "5.2.0",
"jest": "24.5.0",
"jest-junit": "6.3.0",
"jsdom": "14.0.0",
"lodash.includes": "4.3.0",
"lodash.times": "4.3.2",
"preact": "8.4.2",
"preact-compat": "3.18.4",
"prettier": "1.16.4",
"react": "16.5.2",
"react-dom": "16.8.1",
"react-test-renderer": "16.8.1",
"react": "16.8.4",
"react-dom": "16.8.4",
"react-test-renderer": "16.8.4",
"recompose": "0.30.0",
"recursive-rename": "2.0.0",
"rimraf": "2.6.3",
"rollup": "1.6.0",
"rollup-plugin-commonjs": "9.2.1",
"rollup-plugin-filesize": "6.0.1",
"rollup-plugin-invariant": "0.4.2",
"rollup-plugin-node-resolve": "3.4.0",
"rollup-plugin-node-resolve": "4.0.1",
"rollup-plugin-typescript2": "0.20.1",
"rollup-plugin-uglify": "6.0.2",
"ts-jest": "24.0.0",
"tsc-watch": "2.1.2",
"tslint": "5.13.1",
"typescript": "3.1.6",
"tslint": "5.14.0",
"typescript": "3.3.3333",
"typescript-require": "0.2.10",
"zen-observable-ts": "0.8.16"
"zen-observable-ts": "0.8.18"
},
"dependencies": {
"apollo-utilities": "^1.2.1",
"hoist-non-react-statics": "^3.0.0",
"hoist-non-react-statics": "^3.3.0",
"lodash.isequal": "^4.5.0",
"prop-types": "^15.6.0",
"ts-invariant": "^0.3.0",
"prop-types": "^15.7.2",
"ts-invariant": "^0.3.2",
"tslib": "^1.9.3"
}
}
9 changes: 7 additions & 2 deletions src/mutation-hoc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function withMutation<
if (typeof mapPropsToOptions !== 'function') mapPropsToOptions = () => options as MutationOpts;

return (
WrappedComponent: React.ComponentType<TChildProps & TProps>,
WrappedComponent: React.ComponentType<TProps & TChildProps>,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching the TProps & TChildProps order around has no technical merit - it just bugged me!

): React.ComponentClass<TProps> => {
const graphQLDisplayName = `${alias}(${getDisplayName(WrappedComponent)})`;
class GraphQL extends GraphQLBase<TProps, TChildProps> {
Expand Down Expand Up @@ -67,7 +67,12 @@ export function withMutation<
childProps = operationOptions.props(newResult) as any;
}

return <WrappedComponent {...props} {...childProps} />;
return (
<WrappedComponent
{...props as TProps}
{...childProps as any}
/>
);
}}
</Mutation>
);
Expand Down
20 changes: 16 additions & 4 deletions src/query-hoc.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import { ApolloError } from 'apollo-client';
import { DocumentNode } from 'graphql';
import hoistNonReactStatics from 'hoist-non-react-statics';

Expand Down Expand Up @@ -45,7 +44,7 @@ export function withQuery<
// allow for advanced referential equality checks
let lastResultProps: TChildProps | void;
return (
WrappedComponent: React.ComponentType<TChildProps & TProps>,
WrappedComponent: React.ComponentType<TProps & TChildProps>,
): React.ComponentClass<TProps> => {
const graphQLDisplayName = `${alias}(${getDisplayName(WrappedComponent)})`;
class GraphQL extends GraphQLBase<TProps, TChildProps> {
Expand Down Expand Up @@ -79,7 +78,15 @@ export function withQuery<
});
}
// if we have skipped, no reason to manage any reshaping
if (shouldSkip) return <WrappedComponent {...props} />;
if (shouldSkip) {
return (
<WrappedComponent
{...props as TProps}
{...{} as TChildProps}
/>
);
}

// the HOC's historically hoisted the data from the execution result
// up onto the result since it was passed as a nested prop
// we massage the Query components shape here to replicate that
Expand All @@ -95,7 +102,12 @@ export function withQuery<
childProps = lastResultProps;
}

return <WrappedComponent {...props} {...childProps} />;
return (
<WrappedComponent
{...props as TProps}
{...childProps as TChildProps}
/>
);
}}
</Query>
);
Expand Down
19 changes: 16 additions & 3 deletions src/subscription-hoc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function withSubscription<
// allow for advanced referential equality checks
let lastResultProps: TChildProps | void;
return (
WrappedComponent: React.ComponentType<TChildProps & TProps>,
WrappedComponent: React.ComponentType<TProps & TChildProps>,
): React.ComponentClass<TProps> => {
const graphQLDisplayName = `${alias}(${getDisplayName(WrappedComponent)})`;
class GraphQL extends GraphQLBase<TProps, TChildProps, { resubscribe: boolean }> {
Expand Down Expand Up @@ -85,7 +85,15 @@ export function withSubscription<
});
}
// if we have skipped, no reason to manage any reshaping
if (shouldSkip) return <WrappedComponent {...props} />;
if (shouldSkip) {
return (
<WrappedComponent
{...props as TProps}
{...{} as TChildProps}
/>
);
}

// the HOC's historically hoisted the data from the execution result
// up onto the result since it was passed as a nested prop
// we massage the Query components shape here to replicate that
Expand All @@ -101,7 +109,12 @@ export function withSubscription<
childProps = lastResultProps;
}

return <WrappedComponent {...props} {...childProps} />;
return (
<WrappedComponent
{...props as TProps}
{...childProps as TChildProps}
/>
);
}}
</Subscription>
);
Expand Down
16 changes: 9 additions & 7 deletions src/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface MockedProviderProps<TSerializedCache = {}> {
cache?: ApolloCache<TSerializedCache>;
resolvers?: Resolvers;
childProps?: object;
children?: React.ReactElement;
}

export interface MockedProviderState {
Expand Down Expand Up @@ -47,13 +48,14 @@ export class MockedProvider extends React.Component<MockedProviderProps, MockedP
}

public render() {
const { childProps } = this.props;

return (
<ApolloProvider client={this.state.client}>
{React.cloneElement(React.Children.only(this.props.children), { ...childProps })}
</ApolloProvider>
);
const { children, childProps } = this.props;
return children
? (
<ApolloProvider client={this.state.client}>
{React.cloneElement(React.Children.only(children), { ...childProps })}
</ApolloProvider>
)
: null;
}

public componentWillUnmount() {
Expand Down
6 changes: 4 additions & 2 deletions src/walkTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ export function walkTree(
if (isReactElement(element)) {
if (typeof element.type === 'function') {
const Comp = element.type;
const props = Object.assign({}, Comp.defaultProps, getProps(element));
let childContext = context;
let child;

// Are we are a react class?
if (isComponentClass(Comp)) {
const props = Object.assign({}, Comp.defaultProps, getProps(element));
const instance = new Comp(props, context);
// In case the user doesn't pass these to super in the constructor.
// Note: `Component.props` are now readonly in `@types/react`, so
Expand Down Expand Up @@ -104,12 +104,14 @@ export function walkTree(

child = instance.render();
} else {

// Just a stateless functional
if (visitor(element, null, newContext, context) === false) {
return;
}

child = Comp(props, context);
const FC = Comp as React.FunctionComponent;
child = FC(getProps(element), context);
}

if (child) {
Expand Down
4 changes: 2 additions & 2 deletions test/client/ApolloProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ describe('<ApolloProvider /> Component', () => {
// });

it('should add the client to the children context', () => {
const tree = TestUtils.renderIntoDocument(
const tree = TestUtils.renderIntoDocument<React.Component<any, any>>(
<ApolloProvider client={client}>
<Child />
<Child />
Expand All @@ -179,7 +179,7 @@ describe('<ApolloProvider /> Component', () => {
});

it('child component should be able to query new client when props change', () => {
const container = TestUtils.renderIntoDocument(
const container = TestUtils.renderIntoDocument<React.Component<any, any>>(
<Container client={client} />,
) as React.Component<any, any>;

Expand Down
8 changes: 6 additions & 2 deletions test/client/getDataFromTree.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ describe('SSR', () => {
expect(elementCount).toEqual(2);
});

it('function stateless components with React 16.3 context', () => {
// `walkTree` is deprecated and will be removed in `react-apollo` 3.0.
// It is no longer being updated to work with newer versions of `react`.
xit('function stateless components with React 16.3 context', () => {
if (!React.createContext) {
// Preact doesn't support createContext yet, see https://github.com/developit/preact/pull/963
return;
Expand Down Expand Up @@ -415,7 +417,9 @@ describe('SSR', () => {
});
});

it('basic classes with React 16.3 context', () => {
// `walkTree` is deprecated and will be removed in `react-apollo` 3.0.
// It is no longer being updated to work with newer versions of `react`.
xit('basic classes with React 16.3 context', () => {
if (!React.createContext) {
// Preact doesn't support createContext yet, see https://github.com/developit/preact/pull/963
return;
Expand Down
5 changes: 3 additions & 2 deletions test/internal-api/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ describe('parser', () => {
const query = `
query One { user { name } }
`;

expect(parser.bind(null, query)).toThrowError(/not a valid GraphQL DocumentNode/);
expect(
parser.bind(null, query as any)
).toThrowError(/not a valid GraphQL DocumentNode/);
});

it('should return the name of the operation', () => {
Expand Down