Skip to content

TypeError thrown when directives is undefined #36

Open
@fetimo

Description

@fetimo

I'm not entirely sure how I managed to do this and feel it must be an edge-case but I have a Field without a directives property (it's a __typename field). This makes apollo-link-serialize throw an error when used in conjunction with apollo-link-queue and opening the gate.

Specific error is: TypeError: can't access property "map", directives is undefined

The check on this line assumes that directives is an array but it could also be undefined. An extra data integrity check, something like if (!directive) return [];, seems to do the trick and resumes expected behaviour. If you think this use-case is valid I'll try to put together a PR with a test for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions