( advancedSettings: FeedAdvancedSettings[], queryClient: QueryClient, manipulate: ManipulateAdvancedSettingsFunc, user: LoggedUser | undefined, feedId: string | undefined, )
| 121 | ) => FeedSettings; |
| 122 | |
| 123 | const onMutateAdvancedSettings = async ( |
| 124 | advancedSettings: FeedAdvancedSettings[], |
| 125 | queryClient: QueryClient, |
| 126 | manipulate: ManipulateAdvancedSettingsFunc, |
| 127 | user: LoggedUser | undefined, |
| 128 | feedId: string | undefined, |
| 129 | ): Promise<() => Promise<void>> => { |
| 130 | const queryKey = getFeedSettingsQueryKey(user, feedId); |
| 131 | const currentSettings = getCachedFeedSettingsOrThrow( |
| 132 | queryClient, |
| 133 | queryKey, |
| 134 | 'advanced_settings', |
| 135 | ); |
| 136 | const newData = manipulate( |
| 137 | normalizeFeedSettings(currentSettings), |
| 138 | advancedSettings, |
| 139 | ); |
| 140 | const keys = [queryKey, queryKey]; |
| 141 | await updateQueryData(queryClient, newData, keys); |
| 142 | return async () => { |
| 143 | await updateQueryData(queryClient, currentSettings, keys); |
| 144 | }; |
| 145 | }; |
| 146 | |
| 147 | type ManipulateTagFunc = ( |
| 148 | feedSettings: FeedSettings, |
no test coverage detected