mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-03-28 18:04:19 -04:00
Compare commits
1 Commits
v5-develop
...
duplicate-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c087f0a80 |
@@ -122,13 +122,17 @@ export const useSaveProviderSettings = <T extends ModelBase>(
|
||||
},
|
||||
onSuccess: (updatedSettings: T) => {
|
||||
queryClient.setQueryData<T[]>([path], (oldData = []) => {
|
||||
if (id) {
|
||||
return oldData.map((item) =>
|
||||
item.id === updatedSettings.id ? updatedSettings : item
|
||||
);
|
||||
const existingIndex = oldData.findIndex(
|
||||
(item) => item.id === updatedSettings.id
|
||||
);
|
||||
|
||||
if (existingIndex === -1) {
|
||||
return [...oldData, updatedSettings];
|
||||
}
|
||||
|
||||
return [...oldData, updatedSettings];
|
||||
return oldData.map((item) =>
|
||||
item.id === updatedSettings.id ? updatedSettings : item
|
||||
);
|
||||
});
|
||||
onSuccess?.(updatedSettings);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user