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

Function updateQueryData

packages/shared/src/hooks/useMutateFilters.ts:98–116  ·  view source on GitHub ↗
(
  queryClient: QueryClient,
  newSettings: FeedSettings,
  keys: string[][],
)

Source from the content-addressed store, hash-verified

96};
97
98async function updateQueryData(
99 queryClient: QueryClient,
100 newSettings: FeedSettings,
101 keys: string[][],
102): Promise<void> {
103 await Promise.all(
104 keys.map(async (key) => {
105 await queryClient.cancelQueries({ queryKey: key });
106 queryClient.setQueryData<FeedSettingsData>(key, (cachedData) => {
107 if (!cachedData) {
108 return cachedData;
109 }
110 const newData = structuredClone(cachedData);
111 newData.feedSettings = newSettings;
112 return newData;
113 });
114 }),
115 );
116}
117
118type ManipulateAdvancedSettingsFunc = (
119 feedSettings: FeedSettings,

Callers 3

onMutateAdvancedSettingsFunction · 0.70
onMutateTagsSettingsFunction · 0.70
onMutateSourcesSettingsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected