Skip to content

fix: prevent environment form from resetting while editing#4626

Open
veksen wants to merge 1 commit into
Dokploy:canaryfrom
veksen:veksen/textarea-resets-while-editing
Open

fix: prevent environment form from resetting while editing#4626
veksen wants to merge 1 commit into
Dokploy:canaryfrom
veksen:veksen/textarea-resets-while-editing

Conversation

@veksen

@veksen veksen commented Jun 13, 2026

Copy link
Copy Markdown

What is this PR about?

While editing a service's Environment Settings, in-progress changes could be silently wiped before you got to save them — e.g. you start typing, scroll down to the Save button, and the textarea resets to the previous value.

The root cause: the application details page polls the application.one query every 5s (refetchInterval: 5000). ShowEnvironment shares that same query (react-query dedupes by key), so every poll delivered fresh data into a useEffect that unconditionally called form.reset(...), discarding any unsaved edits.

The fix gates the reset on the form not being dirty, so a background refetch only re-syncs the form when the user has no unsaved edits. After a successful save, the dirty baseline is reset so the form continues to sync with the server normally.

Checklist

Before submitting this PR, please make sure that:

Issues related (if applicable)

N/A

Screenshots (if applicable)

N/A

The application environment editor shares the application.one query with
its parent page, which polls every 5s. Each refetch pushed fresh data
into a useEffect that called form.reset(), wiping any in-progress edits
(e.g. while scrolling down to the Save button). Gate the reset on the
form not being dirty so background refetches no longer clobber unsaved
edits, and reset the dirty baseline after a successful save so the form
re-syncs with the server normally.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@veksen veksen requested a review from Siumauricio as a code owner June 13, 2026 00:28
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.

1 participant