mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Signed-off-by: Tyler Longwell <tlongwell@block.xyz> Co-authored-by: npub17jjz49l9jjmhhk7cac63j8yt9z555n9cw8vk7v5jz4vzw4ppld5qgj57cc <f4a42a97e594b77bdbd8ee35191c8b28a94a4cb871d96f32921558275421fb68@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Tyler Longwell <tlongwell@block.xyz> Co-authored-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1cc3ha7z055mu0rwwu7806t2wt8mj3pvu0uv5mfp2c50dahaqhczshdalg6 <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1jh9wn95s0472h86ahapupaf7m6kx4v9sx2n0atj2hltcfer8k06s5n3pyf <95cae996907d7cab9f5dbf43c0f53edeac6ab0b032a6feae4abfd784e467b3f5@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1t2tgm7d8f995uqvmnm8h88sg3wnpp9a5xysjf6dg3tjmgt3ltulqdp8ehr <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1jmc9dt2lyvzu3h0kxlwxt5zg4fxp9476awyxw6gwxn72g6cw7exqs64whm <96f056ad5f2305c8ddf637dc65d048aa4c12d7daeb8867690e34fca46b0ef64c@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1mprnacetjua2xx3p5eddmhxyk6wv929ymm5py8kd2xfxurxahspqqlgyta <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co>
85 lines
2.0 KiB
TypeScript
85 lines
2.0 KiB
TypeScript
const RELAY_QUERY_ROOTS = new Set<string>([
|
|
"archivedIdentities",
|
|
"channel-canvas",
|
|
"channel-messages",
|
|
"channels",
|
|
"contact-list",
|
|
"custom-emoji",
|
|
"custom-emoji-own",
|
|
"forum-posts",
|
|
"forum-thread",
|
|
"global-notes",
|
|
"home-feed",
|
|
"liked-notes",
|
|
"my-notes",
|
|
"myRelayMembership",
|
|
"oaOwner",
|
|
"presence",
|
|
"profile",
|
|
"pulse-note",
|
|
"pulse-reactions",
|
|
"pulse-timeline",
|
|
"relay-agents",
|
|
"relayMembers",
|
|
"reminders",
|
|
"run-approvals",
|
|
"search-messages",
|
|
"thread-replies",
|
|
"user-profile",
|
|
"user-search",
|
|
"user-status",
|
|
"users-batch",
|
|
"workflow",
|
|
"workflow-runs",
|
|
"workflows",
|
|
"workflows-all",
|
|
]);
|
|
|
|
const RELAY_PROJECT_QUERY_PARTS = new Set<string>([
|
|
"activity-summaries",
|
|
"issues",
|
|
"pull-requests",
|
|
]);
|
|
|
|
const LOCAL_PROJECT_QUERY_PARTS = new Set<string>([
|
|
"commit-diff",
|
|
"local-repo-diff",
|
|
"local-repo-snapshot",
|
|
"local-repositories",
|
|
"repo-diff",
|
|
"repo-snapshot",
|
|
"repo-state",
|
|
"repo-sync-status",
|
|
]);
|
|
|
|
function isRelayDependentProjectQueryKey(queryKey: readonly unknown[]) {
|
|
if (queryKey[0] === "projects") {
|
|
const scope = queryKey[1];
|
|
if (scope === undefined) return true;
|
|
if (typeof scope !== "string") return false;
|
|
if (LOCAL_PROJECT_QUERY_PARTS.has(scope)) return false;
|
|
return RELAY_PROJECT_QUERY_PARTS.has(scope);
|
|
}
|
|
|
|
if (queryKey[0] === "project") {
|
|
const scope = queryKey[2];
|
|
if (scope === undefined) return true;
|
|
if (typeof scope !== "string") return false;
|
|
if (LOCAL_PROJECT_QUERY_PARTS.has(scope)) return false;
|
|
return RELAY_PROJECT_QUERY_PARTS.has(scope);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
export function isRelayDependentQueryKey(queryKey: readonly unknown[]) {
|
|
const root = queryKey[0];
|
|
if (typeof root !== "string") return false;
|
|
if (RELAY_QUERY_ROOTS.has(root)) return true;
|
|
return isRelayDependentProjectQueryKey(queryKey);
|
|
}
|
|
|
|
export function isRelayDependentQuery(query: { queryKey: readonly unknown[] }) {
|
|
return isRelayDependentQueryKey(query.queryKey);
|
|
}
|