Giter Club home page Giter Club logo

Comments (4)

budde377 avatar budde377 commented on August 26, 2024

❌ document object seems to be broken. Looks like the response only includes __typename on featuredMedia, and not id, src, .... The query executes just fine, but Fragment$...$$Image.fromJson() throws <type 'Null' is not a subtype of type 'String' in type cast

I've tried to re-produce your issue in #238 and it seems right to me. Check that you are on the latest (beta) version or provide a reproducible example.

from graphql_codegen.

bogdibota avatar bogdibota commented on August 26, 2024

You are right. Everything seems to be fine there.

I created a debug link for the GraphQLClient and the document and raw response seem correct.

Maybe this is a caching issue? Either way, codegen looks perfectly fine.

Thanks for your help!

from graphql_codegen.

KhaleelSH avatar KhaleelSH commented on August 26, 2024

@budde377 I believe this issue appears when you set addTypename: false in build configs

from graphql_codegen.

bogdibota avatar bogdibota commented on August 26, 2024

finally got around to solving this. apparently, it's related to the normalize package needing the possibleTypesMap to correctly update the cache for fragments on union types.

see https://stackoverflow.com/a/70977414 for an explanation

import 'package:[...]/__schema.graphql.dart'; // generated via graphql_codegen

// ...

  final graphQLClient = GraphQLClient(
    link: link,
    cache: GraphQLCache(
      possibleTypes: possibleTypesMap, // <-- added this line
    ),
  );

from graphql_codegen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.