authorgravatar for abdulazeez44@gmail.comAbdul Azeez <abdulazeez44@gmail.com> 2026-09-03 02:54:24+05:30
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-02 17:24:24-04:00
log5a9b56291f82b9269346053594d8b5dfca736976
tree4121f4e473d8debdec13ae58385db3e6a99abb31
parent46b5c66406b9942589d7e9132beeafda2434f113
signature Signed by PGP key B5690EEEBB952194

fix(web): warn when shared settings have no target environment (#9207)


1 files changed, 14 insertions(+), 7 deletions(-)

apps/web/src/hooks/useSettings.ts+14-7
......@@ -377,24 +377,31 @@ function useUpdateSettingsTarget(environmentId: EnvironmentId | null) {
377377
378378 if (Object.keys(serverPatch).length > 0) {
379379 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 = () =>
387382 toastManager.add({
388383 type: "warning",
389384 title: "Setting not saved",
390385 description: PRIMARY_SETTINGS_UNAVAILABLE_MESSAGE,
391386 });
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 }
392396 }
393397 if (Object.keys(sharedPatch).length > 0) {
394398 const targets = new Set(connectedEnvironmentIds);
395399 if (environmentId) {
396400 targets.add(environmentId);
397401 }
402 if (targets.size === 0) {
403 warnUnsaved();
404 }
398405 for (const targetId of targets) {
399406 void persistServerSettings({
400407 environmentId: targetId,