( queryClient: QueryClient, newSettings: FeedSettings, keys: string[][], )
| 96 | }; |
| 97 | |
| 98 | async 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 | |
| 118 | type ManipulateAdvancedSettingsFunc = ( |
| 119 | feedSettings: FeedSettings, |
no outgoing calls
no test coverage detected