Repository navigation
Keep tool editor edits when the connector page re-renders - #1999
Open
helpcodeai wants to merge 2 commits into
Open
helpcodeai wants to merge 2 commits into
helpcodeai wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The connector page passes the tool editor a new
existingToolobject on every render. The editor reset its whole form in an effect keyed on that object, so any re-render of the page while a tool was open threw away what the user had typed. One example: opening the "Add Tool" panel while editing a tool.It is also the most likely source of the open Sentry issue
Maximum update depth exceededon/connectors/:id(CLOUD-FRONTEND-Z): every page render made the editor call about 20 setters. That link is not confirmed, because the Sentry stack is minified.Changes
ToolEditor: the reset effect is keyed on the tool's JSON content, not on the object. The form loads again only when the tool really changes (for example after a save).Could not establish connection. Receiving end does not exist.. Chrome raises it when an extension messages itself; our app never callschrome.runtime(CLOUD-FRONTEND-13, on/login).tool-editor-keeps-edits.spec.ts(mocked API): open a tool, rename it, open "Add Tool", and the typed name is still there.Type
Testing
In
packages/frontend:npx playwright test tests/e2e/tool-editor-keeps-edits.spec.ts: fails without the fix (the field is reset toget_users) and passes with it.connector-page-storage-blocked.spec.tsandtool-editor-round-trip.spec.tsas well: 15 passed.npx tsc --noEmit -p tsconfig.json: no errors.npx eslinton the changed files: 0 errors. 1 warning (react-hooks/set-state-in-effect), which main already has.Frontend only; it behaves the same in Cloud and self-hosted.
Checklist
npm test)Related Issues
Sentry CLOUD-FRONTEND-Z (likely cause), CLOUD-FRONTEND-13 (noise).