MCPcopy Create free account
hub / github.com/dailydotdev/apps / clearBoostedFlag

Function clearBoostedFlag

packages/shared/src/features/boost/useStopBoost.ts:70–94  ·  view source on GitHub ↗
(campaign: Campaign)

Source from the content-addressed store, hash-verified

68 const { onCancelBoost, isLoadingCancel } = useCampaignMutation({});
69
70 const clearBoostedFlag = (campaign: Campaign) => {
71 const id = campaign.referenceId;
72
73 if (campaign.type === CampaignType.Post) {
74 updatePostCache(client, id, (old) => ({
75 flags: withoutCampaign(old.flags),
76 }));
77
78 client.setQueryData<PostData>(getPostByIdKey(id), (old) =>
79 old
80 ? {
81 ...old,
82 post: { ...old.post, flags: withoutCampaign(old.post.flags) },
83 }
84 : old,
85 );
86 }
87
88 if (campaign.type === CampaignType.Squad) {
89 client.setQueryData<Squad>(
90 generateQueryKey(RequestKey.Squad, user, campaign.source?.handle),
91 (old) => (old ? { ...old, flags: withoutCampaign(old.flags) } : old),
92 );
93 }
94 };
95
96 const onStopBoost = async (campaign: Campaign) => {
97 const prompt =

Callers 1

onStopBoostFunction · 0.85

Calls 4

updatePostCacheFunction · 0.90
getPostByIdKeyFunction · 0.90
generateQueryKeyFunction · 0.90
withoutCampaignFunction · 0.85

Tested by

no test coverage detected