reactjsmaterial-uiapollo-clientreact-tsxreact-data-table-component

React data overridden in Data Table after filtering data


React Data overridden in Data table after filtering data Tech stack used: React typescript and GraphQL (apollo client).


Solution

  • Above issue is resolved by the below given code (React typescript):

     const defaultOptions: DefaultOptions = {
            watchQuery: {
                fetchPolicy: 'no-cache',
                errorPolicy: 'all',
            },
            query: {
                fetchPolicy: 'no-cache',
                errorPolicy: 'all',
            },
            mutate: {
                errorPolicy: 'all',
            },
        };
    
        return new ApolloClient({
            uri: 'http://example/graphql',
            cache: new InMemoryCache(),
            defaultOptions: defaultOptions
        })