UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

42 lines (41 loc) 1.59 kB
import { BUNDLE_MASK_ACTIONS_REQUIRED as i } from "../utils/SynapseConstants.js"; import { matchQuery as y } from "@tanstack/query-core"; import { isEqual as n, isObject as s, isNumber as a } from "lodash-es"; function Q(r, t, u, e) { return r.resetQueries({ // We invalidate all table query results because this entity could be shown in a view or used to compose JOINed tables // Reset all table query results to avoid showing stale data (SWC-6722) // Additionally, we do not want to wait for all tables to rebuild before we consider the invalidation 'complete' queryKey: t.getAllTableQueryResultsKey() }), r.invalidateQueries({ queryKey: t.getEntityQueryKey(u), predicate: (l) => e && n(l.queryKey, e) ? !1 : !y({ queryKey: t.getAllTableQueryResultsKey() }, l) }); } function f(r) { return [ // individual entity { queryKey: r.getAllEntityActionsRequiredQueryKey() }, // actions required for entities on the download list { queryKey: r.getDownloadListBaseQueryKey() }, { queryKey: r.getAllTableQueryResultsKey(), predicate: (t) => { const u = t.queryKey; for (const e of u) if (s(e) && "tableQueryBundleRequest" in e && s(e.tableQueryBundleRequest) && "partMask" in e.tableQueryBundleRequest && a(e.tableQueryBundleRequest.partMask) && e.tableQueryBundleRequest.partMask & i) return !0; return !1; } } ]; } export { f as getAllActionsRequiredQueryFilters, Q as invalidateAllQueriesForEntity }; //# sourceMappingURL=QueryFilterUtils.js.map