Skip to content

fix(environment-table-autosave)/autosave removes the already added characters in environment table#8410

Open
sachin-thakur-bruno wants to merge 3 commits into
usebruno:mainfrom
sachin-thakur-bruno:fix/environment-table-auto-save
Open

fix(environment-table-autosave)/autosave removes the already added characters in environment table#8410
sachin-thakur-bruno wants to merge 3 commits into
usebruno:mainfrom
sachin-thakur-bruno:fix/environment-table-auto-save

Conversation

@sachin-thakur-bruno

Copy link
Copy Markdown
Contributor

Description

When Auto Save is triggered while the user is actively typing (especially with Auto Save delays below 1000 ms), the cursor jumps back to its previous position.
This interrupts typing and causes newly entered text to be inserted at the wrong location, making it seem like recent input was lost.

JIRA

Problem

EnvironmentVariablesTable uses Formik with initialValues from environment.variables in Redux.

After every autosave, Redux updated environment.variables with a new array reference. Because enableReinitialize was enabled, Formik reset the form while the user was still typing. The form could not distinguish its own save from a real external update.

Fix

  • Removed enableReinitialize.
  • Added a snapshot tracker to remember values emitted by the form.
  • Only reinitialize when environment.variables changes and the new values are not one of the form's own snapshots.
  • Snapshots are recorded for autosave, handleSave, and handleSaveAll.

This prevents save echoes from resetting the form while still allowing genuine external updates to reload the form.

Added e2e for the behaviour and tested them before and after the fix. Before the fix tests were failing as autosave was clearing the texts. After the fix working as autosave is not clearing the unsaved text.

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant