Tag: #reactjs
-
How to convert the data retrieved by GraphQL + Relay to normal React state?
0 Example from the documentation: import type {AppQueryType} from ‘AppQueryType.graphql’; const React = require(‘React’); const {graphql, useQueryLoader, usePreloadedQuery} = require(‘react-relay’); const AppQuery = graphql` query AppQuery($id: ID!) { user(id: $id) { name } } `; type Props = { initialQueryRef: PreloadedQuery<AppQueryType>, }; function NameLoader(props) { const [queryReference, loadQuery] = useQueryLoader( AppQuery, props.initialQueryRef, /* e.g. provided…
-
Access multiple nested TypeScript type generated from GraphQL
0 I need to access only the "departments" type in this large type generated from GraphQL: export type GetCompanyChartQuery = ( { __typename?: ‘Query’ } & { generateOrgChart?: Maybe<( { __typename?: ‘DepartmentNode’ } & Pick<DepartmentNode, ‘name’> & { manager?: Maybe<( { __typename?: ‘EmployeeNode’ } & Pick<EmployeeNode, ‘name’ | ‘mobilePhone’> )>, departments?: Maybe<Array<Maybe<( { __typename?: ‘DepartmentNode’…
-
Can’t import the named export XXXX from non EcmaScript module (only default export is available)
30 I have a client-server setup, in which the client(create-react-app) runs on localhost:3000 and the server is an express server which is built on node and I’m attempting to build graphql schema-resolvers setup. I’m able to import .graphql files on the server, however, on the client side, I’m using this setup by graphql-tools. When I’m…
-
Currently trying to create a graphql resolver mutation for reset Password
0 I’m facing a unusual error while accessing the reset password button. the error: Uncaught (in promise) ApolloError: error:0200009F:rsa routines::pkcs decoding error can anyone help me with this I’m trying to set the new password when i click the reset password button I’m using typegraphql, typeorm, react reactjs typescript graphql typeorm typegraphql Share Follow asked…
-
Why isn’t my react app mapping my graphQL query?
0 I am working on a component to map all posts from a graphQL query on the client side using semantic UI. I am running it locally and the webpage is not showing any of the data even though this query works in apollo studio. Here’s the code for the component. import React from ‘react’;…
-
Apollo-Server subscription to Postgres database
1 I have a postgres table (User) which is fed data from a third party service like Airflow or Nifi. I am running an apollo-server with NodeJS which fetches the user data and passes this data to the React component. One way to show the details of users is using polling in apollo-client which will…
-
Graphql Codegen’s client-preset-swc-plugin not working at all
0 I couldn’t use Graphql Codegen’s client-preset-swc-plugin with Vite at all to reduce the bundle size. It panics when trying to build for production, I’m getting this error: [vite-plugin-pwa:build] failed to handle: failed to invoke plugin: failed to invoke plugin on ‘Some("/home/user/project/web/src/index.tsx")’ Caused by: 0: failed to invoke `/home/user/project/web/node_modules/@graphql-codegen/client-preset-swc-plugin/swc_plugin.wasm` as js transform plugin at /home/user/project/web/node_modules/@graphql-codegen/client-preset-swc-plugin/swc_plugin.wasm…
-
How can I cache nested objects with Apollo Client?
3 I’m using the Contentful GraphQL API to fetch a collection of items, in this example football clubs. query Clubs($limit: Int!, $skip: Int!) { clubCollection(limit: $limit, skip: $skip) { total items { name description } } } The structure of the response is: clubCollection: { items: [{ … array of all the clubs }] }…
-
Why apollo client removes some properties (sets them to null) from a cached object spontaneously?
0 I’m using @apollo/client version 3.7.3 in a react.js, typescript application. After fetching a list of objects from the server, some values are removed from the cache spontaneously! So when the client gets the data from the server, it stores them in the cache to be used in the UI and the cache version is…