question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught Error: Illegal fetchable type "CustomerData", super class can only be specified for object type but its category is "EMBEDDED"

See original GitHub issue

Good brother, this library is very nice, very like to use, but encountered some problems, confused me

This is the relevant screenshot and code

code gen script

import { ApolloGenerator, loadRemoteSchema } from 'graphql-ts-client-codegen';
import { join } from 'path';

// https://github.com/babyfish-ct/graphql-ts-client/blob/master/doc/apollo_zh_CN.md
const generator = new ApolloGenerator({
  schemaLoader: async () => {
    return loadRemoteSchema(
      'https://ininderprint-backend-nestjs.cloud-dev.ininderprint.tw/vendor-api/graphql'
    );
  },
  targetDir: join(__dirname, '../src/gencode') as string,
  defaultFetcherExcludeMap: {
    // Department: ['avgSalary'],
  },
  scalarTypeMap: {
    String: 'string',
  },
});
generator.generate();

graphql req file

import { useTypedQuery } from 'gencode';
import { query$, userProfile$ } from 'gencode/fetchers';
import React from 'react';

export default function Orders() {
  const { data, loading, error } = useTypedQuery(
    query$.myProfile(
      userProfile$.userUuid.nickname.firstName.lastName.gender.birthday.avatar
    )
  );

  return (
    <>
      {loading && <div style={{ color: 'green' }}>Loading...</div>}
      {error && <div style={{ color: 'red' }}>Error</div>}
      <div>userUuid: {data?.myProfile.userUuid}</div>
      <div>userUuid: {data?.myProfile.nickname}</div>
      <div>userUuid: {data?.myProfile.firstName}</div>
      <div>userUuid: {data?.myProfile.lastName}</div>
      <div>userUuid: {data?.myProfile.gender}</div>
      <div>userUuid: {data?.myProfile.birthday}</div>
      <div>userUuid: {data?.myProfile.avatar}</div>
    </>
  );
}

screenshot relate info

oThG11.md.png

oThyct.md.png

oThfAg.md.png

Trouble brother,Thank you very much and good luck

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
babyfish-ctcommented, Dec 11, 2021

Give me your SDL please

BTW, your fetcher is too longer, you can try to use the default fetcher “userProfile$$”

0reactions
wedreamercommented, Dec 13, 2021

With the help of the author, the related problem was found, and the corresponding update is in v3.0.9,The document is related to doc, the reason is **my graphql type has union type and this dont have ID **。

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-relay Invalid use of @refetchable on fragment
I am learning react-relay (v13) and have a problem specifying a pagination fragment with @refetchable. It ...
Read more >
relay-hooks/useRefetchable.md at master - GitHub
You can use useRefetchable when you want to fetch and re-render a fragment with different data: Arguments: They are the same as useFragment....
Read more >
useRefetchableFragment - Relay
You can use useRefetchableFragment when you want to fetch and re-render a fragment with different data: import type ...
Read more >
Accelerating Data Transformation with IBM DB2 Analytics ...
Use cases that are enabled by accelerator-only tables and in-database ... This IBM Redbooks® publication describes the new table type that is introduced ......
Read more >
Search Results - CVE
A security agent directory traversal vulnerability in Trend Micro Apex One and Apex One as a Service could allow a local attacker to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found