Skip to content

fix unsaved changes showing when no changes in extensions#6743

Merged
zanesq merged 2 commits intomainfrom
zane/extension-cancel
Jan 27, 2026
Merged

fix unsaved changes showing when no changes in extensions#6743
zanesq merged 2 commits intomainfrom
zane/extension-cancel

Conversation

@zanesq
Copy link
Collaborator

@zanesq zanesq commented Jan 27, 2026

Summary

Issue: The "Unsaved Changes" dialog was appearing when closing the extension configuration modal even when no changes were made. This happened for extensions that had existing environment variables.

Root Cause: In ExtensionModal.tsx, the hasFormChanges() function had a check called envVarsHaveText that would return true if any environment variable had text in it, regardless of whether it was modified or just loaded from the initial data:

// This was the problematic check
const envVarsHaveText = formData.envVars.some(
  (envVar) =>
    (envVar.key.trim() !== '' || envVar.value.trim() !== '') &&
    envVar.value !== '••••••••'
);

This check was meant to catch cases where users typed something but didn't explicitly mark it as edited. However, it caused false positives for existing extensions with environment variables because those env vars already have text in them.

Fix: Removed the envVarsHaveText check. The other existing checks already cover all necessary cases:

  • envVarsChanged - detects when existing env vars are edited (isEdited === true)
  • envVarsAdded - detects when new env vars are added (length comparison)
  • envVarsRemoved - detects when env vars are removed (length comparison)
  • hasPendingInput - detects when user is typing in the "new env var" input fields

Files Changed:

  1. ui/desktop/src/components/settings/extensions/modal/ExtensionModal.tsx - Removed the redundant envVarsHaveText check
  2. ui/desktop/src/components/settings/extensions/modal/ExtensionModal.test.tsx - Added a test to verify the fix

closes #6732

@zanesq zanesq changed the title fix unsaved changes showing when no changes fix unsaved changes showing when no changes in extensions Jan 27, 2026
@zanesq zanesq requested a review from Abhijay007 January 27, 2026 17:48
@Abhijay007
Copy link
Collaborator

Abhijay007 commented Jan 27, 2026

Hi @zanesq, I tested this, but I wanted to check, Is this change only targeting envVars/request header changes, or does it also cover overall extension changes?

When I change the extension name, description, etc., I don’t see any dialog showing up like before cancelling. It wasn’t showing previously either, but I just wanted to confirm whether we wanted to include those cases as well.

Copy link
Collaborator

@Abhijay007 Abhijay007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zanesq
Copy link
Collaborator Author

zanesq commented Jan 27, 2026

@Abhijay007 good catch I will add name and description and also I noticed port is not triggering it.

@Abhijay007
Copy link
Collaborator

@Abhijay007 good catch I will add name and description and also I noticed port is not triggering it.

I tried editing port it was triggering it for me 🤔 I tried changing it's value in jetbrain extension

@zanesq
Copy link
Collaborator Author

zanesq commented Jan 27, 2026

@Abhijay007 my bad meant timeout field, updated

@zanesq zanesq merged commit 5827ea4 into main Jan 27, 2026
25 of 28 checks passed
@zanesq zanesq deleted the zane/extension-cancel branch January 27, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Got "Unsaved Changes" dialog asked when there's no changes to extension configuration (Desktop v1.12.1)

2 participants