Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for (const key in queryOptions) {
if (!queryOptions.hasOwnProperty(key)) {
continue;
}
const { query, variables, forceFetch } = queryOptions[key];
const observableQuery = watchQuery(queryOptions[key]);
// rudimentary way to manually check cache
let queryData = defaultQueryData as any;
// force fetch shouldn't try to read from the store
if (!forceFetch) {
try {
const result = readQueryFromStore({
store: store.getState()[reduxRootKey].data,
query,
variables,
});
queryData = assign({
errors: null,
loading: false,
}, result);
} catch (e) {/* tslint */}
}
this.data[key] = queryData;
this.handleQueryData(observableQuery, key);
}