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