1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-03-28 18:04:19 -04:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Mark McDowall
3c087f0a80 Prevent duplicating providers when adding a new provider 2026-03-28 14:10:11 -07:00
2 changed files with 24 additions and 195 deletions

View File

@@ -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);
},

View File

@@ -623,19 +623,12 @@
],
"parameters": [
{
"name": "skipTesting",
"name": "forceSave",
"in": "query",
"schema": {
"type": "boolean",
"default": false
}
},
{
"name": "skipValidation",
"in": "query",
"schema": {
"$ref": "#/components/schemas/SkipValidation"
}
}
],
"requestBody": {
@@ -677,19 +670,12 @@
}
},
{
"name": "skipTesting",
"name": "forceSave",
"in": "query",
"schema": {
"type": "boolean",
"default": false
}
},
{
"name": "skipValidation",
"in": "query",
"schema": {
"$ref": "#/components/schemas/SkipValidation"
}
}
],
"requestBody": {
@@ -793,10 +779,11 @@
],
"parameters": [
{
"name": "skipValidation",
"name": "forceTest",
"in": "query",
"schema": {
"$ref": "#/components/schemas/SkipValidation"
"type": "boolean",
"default": false
}
}
],
@@ -2071,19 +2058,12 @@
],
"parameters": [
{
"name": "skipTesting",
"name": "forceSave",
"in": "query",
"schema": {
"type": "boolean",
"default": false
}
},
{
"name": "skipValidation",
"in": "query",
"schema": {
"$ref": "#/components/schemas/SkipValidation"
}
}
],
"requestBody": {
@@ -2125,19 +2105,12 @@
}
},
{
"name": "skipTesting",
"name": "forceSave",
"in": "query",
"schema": {
"type": "boolean",
"default": false
}
},
{
"name": "skipValidation",
"in": "query",
"schema": {
"$ref": "#/components/schemas/SkipValidation"
}
}
],
"requestBody": {
@@ -2288,10 +2261,11 @@
],
"parameters": [
{
"name": "skipValidation",
"name": "forceTest",
"in": "query",
"schema": {
"$ref": "#/components/schemas/SkipValidation"
"type": "boolean",
"default": false
}
}
],
@@ -2392,101 +2366,6 @@
}
}
},
"/api/v5/settings/indexer": {
"get": {
"tags": [
"IndexerSettings"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/IndexerSettingsResource"
}
}
}
}
}
}
},
"/api/v5/settings/indexer/{id}": {
"put": {
"tags": [
"IndexerSettings"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/IndexerSettingsResource"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/IndexerSettingsResource"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/IndexerSettingsResource"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/IndexerSettingsResource"
}
}
}
}
}
},
"get": {
"tags": [
"IndexerSettings"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/IndexerSettingsResource"
}
}
}
}
}
}
},
"/api/v5/language": {
"get": {
"tags": [
@@ -2963,19 +2842,12 @@
],
"parameters": [
{
"name": "skipTesting",
"name": "forceSave",
"in": "query",
"schema": {
"type": "boolean",
"default": false
}
},
{
"name": "skipValidation",
"in": "query",
"schema": {
"$ref": "#/components/schemas/SkipValidation"
}
}
],
"requestBody": {
@@ -3017,19 +2889,12 @@
}
},
{
"name": "skipTesting",
"name": "forceSave",
"in": "query",
"schema": {
"type": "boolean",
"default": false
}
},
{
"name": "skipValidation",
"in": "query",
"schema": {
"$ref": "#/components/schemas/SkipValidation"
}
}
],
"requestBody": {
@@ -3133,10 +2998,11 @@
],
"parameters": [
{
"name": "skipValidation",
"name": "forceTest",
"in": "query",
"schema": {
"$ref": "#/components/schemas/SkipValidation"
"type": "boolean",
"default": false
}
}
],
@@ -7825,32 +7691,6 @@
},
"additionalProperties": false
},
"IndexerSettingsResource": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int32"
},
"minimumAge": {
"type": "integer",
"format": "int32"
},
"retention": {
"type": "integer",
"format": "int32"
},
"maximumSize": {
"type": "integer",
"format": "int32"
},
"rssSyncInterval": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
},
"Language": {
"type": "object",
"properties": {
@@ -8025,10 +7865,6 @@
"type": "string",
"nullable": true
},
"relativePath": {
"type": "string",
"nullable": true
},
"seriesId": {
"type": "integer",
"format": "int32"
@@ -10447,14 +10283,6 @@
],
"type": "string"
},
"SkipValidation": {
"enum": [
"none",
"warnings",
"all"
],
"type": "string"
},
"SortDirection": {
"enum": [
"default",
@@ -11037,9 +10865,6 @@
{
"name": "IndexerFlag"
},
{
"name": "IndexerSettings"
},
{
"name": "Language"
},