| ... | @@ -377,24 +377,31 @@ function useUpdateSettingsTarget(environmentId: EnvironmentId | null) { | ... | @@ -377,24 +377,31 @@ function useUpdateSettingsTarget(environmentId: EnvironmentId | null) { |
| 377 | | 377 | |
| 378 | if (Object.keys(serverPatch).length > 0) { | 378 | if (Object.keys(serverPatch).length > 0) { |
| 379 | const { sharedPatch, localPatch } = splitSharedServerPatch(serverPatch); | 379 | const { sharedPatch, localPatch } = splitSharedServerPatch(serverPatch); |
| 380 | if (environmentId && Object.keys(localPatch).length > 0) { | 380 | // Dropping the write silently leaves the control looking saved. |
| 381 | void persistServerSettings({ | 381 | const warnUnsaved = () => |
| 382 | environmentId, | | |
| 383 | input: { patch: localPatch }, | | |
| 384 | }); | | |
| 385 | } else { | | |
| 386 | // Dropping the write silently leaves the control looking saved. | | |
| 387 | toastManager.add({ | 382 | toastManager.add({ |
| 388 | type: "warning", | 383 | type: "warning", |
| 389 | title: "Setting not saved", | 384 | title: "Setting not saved", |
| 390 | description: PRIMARY_SETTINGS_UNAVAILABLE_MESSAGE, | 385 | description: PRIMARY_SETTINGS_UNAVAILABLE_MESSAGE, |
| 391 | }); | 386 | }); |
| | 387 | if (Object.keys(localPatch).length > 0) { |
| | 388 | if (environmentId) { |
| | 389 | void persistServerSettings({ |
| | 390 | environmentId, |
| | 391 | input: { patch: localPatch }, |
| | 392 | }); |
| | 393 | } else { |
| | 394 | warnUnsaved(); |
| | 395 | } |
| 392 | } | 396 | } |
| 393 | if (Object.keys(sharedPatch).length > 0) { | 397 | if (Object.keys(sharedPatch).length > 0) { |
| 394 | const targets = new Set(connectedEnvironmentIds); | 398 | const targets = new Set(connectedEnvironmentIds); |
| 395 | if (environmentId) { | 399 | if (environmentId) { |
| 396 | targets.add(environmentId); | 400 | targets.add(environmentId); |
| 397 | } | 401 | } |
| | 402 | if (targets.size === 0) { |
| | 403 | warnUnsaved(); |
| | 404 | } |
| 398 | for (const targetId of targets) { | 405 | for (const targetId of targets) { |
| 399 | void persistServerSettings({ | 406 | void persistServerSettings({ |
| 400 | environmentId: targetId, | 407 | environmentId: targetId, |