Skip to content

Keep tool editor edits when the connector page re-renders - #1999

Open
helpcodeai wants to merge 2 commits into
mainfrom
fix/tool-editor-reset
Open

helpcodeai wants to merge 2 commits into
mainfrom
fix/tool-editor-reset

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

The connector page passes the tool editor a new existingTool object 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 exceeded on /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).
  • Sentry: ignore Could not establish connection. Receiving end does not exist.. Chrome raises it when an extension messages itself; our app never calls chrome.runtime (CLOUD-FRONTEND-13, on /login).
  • New Playwright spec tool-editor-keeps-edits.spec.ts (mocked API): open a tool, rename it, open "Add Tool", and the typed name is still there.

Type

  • Bug fix
  • New feature
  • Documentation
  • Refactoring
  • Performance improvement
  • Other (describe below)

Testing

  • Added/updated unit tests
  • Tested manually (describe steps below)
  • No tests needed (explain why)

In packages/frontend:

  • npx playwright test tests/e2e/tool-editor-keeps-edits.spec.ts: fails without the fix (the field is reset to get_users) and passes with it.
  • With connector-page-storage-blocked.spec.ts and tool-editor-round-trip.spec.ts as well: 15 passed.
  • npx tsc --noEmit -p tsconfig.json: no errors.
  • npx eslint on 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

  • My code follows the existing code style
  • I have tested my changes locally
  • I have updated documentation (if applicable)
  • All existing tests pass (npm test)
  • This PR has a descriptive title

Related Issues

Sentry CLOUD-FRONTEND-Z (likely cause), CLOUD-FRONTEND-13 (noise).

This branch has not been deployed

No deployments
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