Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Children of the same type down the tree not inflated #9

Closed
garritfra opened this issue Aug 30, 2021 · 2 comments
Closed

Children of the same type down the tree not inflated #9

garritfra opened this issue Aug 30, 2021 · 2 comments

Comments

@garritfra
Copy link
Contributor

This is a followup issue of the fix added in 1d1e0f1.

The fix works for direct parent/children relations, but not for objects of the same type deeper down the tree.

Failing Test Case

it('works with child data of the same type down the tree', () => {
    const query = gql`
        query {
            todos {
                id
                title
                assignee {
                    id
                    assignedTodos {
                        id
                        title
                    }
                }
            }
        }
    `;
    const data = {
        todos: [{
            __typename: 'Todo',
            id: 'some-id',
            title: 'Do the dishes',
            assignee: [{
                __typename: 'Person',
                id: 'alice',
                assignedTodos: [{
                    __typename: 'Todo',
                    id: 'some-id',
                    title: 'Do the dishes',
                }],
            }],
        }],
    };

    cache.writeQuery({ query, data });

    const inflatedData = inflateCacheData(cache, cache.readQuery({ query }));

    expect(inflatedData).toEqual(data);
});
@mindnektar
Copy link
Owner

Thanks for the test! Please try v1.13.6 :)

@garritfra
Copy link
Contributor Author

Works like a charm. Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants