NerdWalletOSS / apollo-cache-policies

An extension of the Apollo 3 cache with support for advanced cache policies.
Apache License 2.0
156 stars 22 forks source link

TTL doesn't work for query which responded with empty array or scalar #81

Closed qwertypomy closed 2 months ago

qwertypomy commented 3 months ago

Example 1. Empty array

const employeesQuery = gql`
  query employees {
    employees {
      ...employee
    }
  }
  fragment employee on Employee {
    id
    employee_name
    employee_age
    employee_salary
  }
`;

const employeesResponse = {
  employees: [],
};

Example 2. Scalar

const employeesCountQuery = gql`
  query employeesCount {
    employeesCount
  }
`;

const employeesCountResponse = {
  employeesCount: 123,
};

I'll try to find some quick solution, please let me know if you can point me in the right direction