Tag: #reactjs
-
Physical Storage of InMemory Cache of Apollo Client
0 According to Apollo Client docs, the InMemory cache is used in the apollo client cache as instantiated in the below code import { InMemoryCache, ApolloClient } from ‘@apollo/client’; const client = new ApolloClient({ // …other arguments… cache: new InMemoryCache(options) }); Reference: https://www.apollographql.com/docs/react/caching/cache-configuration/ Where is this in-memory storage physically created? Is it in sessionStorage or…
-
Graphql cache: Specify a merge function to a query which is nested under a common type
0 Lets say graphql scema looks like this type query { foodInformation: Foodinformation # some other query types carInformation: CarInformation } type Foodinformation { getDishes(): Dishes! getFilteredDishes(input: filterInput): Dishes! # some other quiries } type PageInformation { pageNumber: int pageSize: int totalPages: int totalItems: int } input FilterInput { name: string id: int comment: string…
-
Updating a list in React / GraphQL
0 I am creating a function that enables an admin to manage which items would be added to the dashboard list of items, He can add/remove items from a list in settings to the actual list in dashboard. I added the following code in Settings.js: import { dashboardList } from ‘./Dashboard’; const dashboardItems = […
-
How to delete an object by pressing a button with onClick via mutation
0 There is code with GraphQL in bff and in the application part. This function is described as follows: shema.js: type Mutation { deleteCart(id: Int): [Cart] } index.js: deleteCart: (_, args) => { carts = carts.filter((c) => c.id !== args.id); return carts; } As declared in query: export const CART_ITEMS = gql` mutation DeleteCart ($id:…
-
useSubscription Socket errors being thrown in the console
1 I hope you are doing well! We are using web sockets in our website with graphQL hence we are using useSubscription. It is working fine, I get the data back when I need it; however, we are facing a small issue that while it is not stopping our website from functioning, it is extremely…
-
issue with graphql-request react onClick handler
0 I am using graphql-request to execute a mutation in an onClick handler in a react application The mutation executes successfully (I can verify by looking at the logs in the backend). The code in onClick handler (loginHandler) following the gqlClient.request never executes (console.log or alert) here is the code, any idea what am I…
-
GraphQL only works on production when also running localhost and Apollo Client is set to localhost only
1 Im working an app using react for the frontend and apollo/client and graphql. It works perfectly on the localhost, but when I deploy to heroku it only works if I also have the app running on the localhost. Here is what I have for the uri. const client = new ApolloClient({ uri: ‘https://localhost:5000/graphql’, cache:…
-
React function executing multiple times (4 times)
0 My function is executed 4 times ? (I am using GrahQL, Appolo-Client, React) One of the issues is that my query returns set of images, which are hosted on S3 and page keeps refreshing with new urls. import React, { useState } from "react" import { useQuery } from "@apollo/client" import styled from "styled-components"…
-
Auto update React.js front-end, when items added in DynamoDb
0 I’m developing a serverless AWS app. For the front-end I’m using react.js, for the back-end (REST API calls), I’m using Claudia API Builder (API Gateway & Lambdas) and I store my data in DynamoDB tables. Problem I want, whenever a user adds an item in a DynamoDB table, this to be shown automatically to…
-
Shopify app keeps reloading after implementing GraphQL API call?
0 I’m learning full stack dev by making a Shopify app, the stack is Javascript, React, Remix, and uses the GraphQL API. I’m consistently running into an issue with calling into the orders api call, the previously working web app will begin to repeatedly reload & then will fail with this error: This app can’t…