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

Avoid relying on constructor.name for instanceOf error check. #2894

Closed

Commits on Mar 25, 2021

  1. Avoid relying on constructor.name for instanceOf error check.

    An improvement beyond graphql#1174, for non-production environments that enable
    minification, such as NODE_ENV='staging'.
    
    Since graphql-js goes to the trouble of providing a Symbol.toStringTag
    property for most of the classes it exports, and that string is immune to
    minification (unlike constructor.name), we should use it for error
    checking in instanceOf(value, constructor) whenever the constructor
    provides a tag, falling back to constructor.name and
    value.constructor.name for constructors that do not define
    Symbol.toStringTag (as before).
    
    Motivating issue/investigation:
    apollographql/apollo-client#7446 (comment)
    benjamn committed Mar 25, 2021
    Configuration menu
    Copy the full SHA
    213b703 View commit details
    Browse the repository at this point in the history
  2. Stop using SYMBOL_TO_STRING_TAG polyfill.

    After rebasing PR graphql#2894 against origin/main, I noticed that the
    src/polyfills/symbols.js module no longer exists, and Symbol.toStringTag
    is used directly elsewhere in the codebase.
    benjamn committed Mar 25, 2021
    Configuration menu
    Copy the full SHA
    717f24e View commit details
    Browse the repository at this point in the history