-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: update action bar value after users click import from url #8643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where the URL bar value is not updated after the user clicks "Import from URL." Key changes include adding a setValue method to the one-line editor, exposing an updateUrl handle in both the action bar and request URL bar, and adding corresponding smoke tests for HTTP and WebSocket requests.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/insomnia/src/ui/components/websockets/websocket-request-pane.tsx | Added a ref to the RequestUrlBar and invoked updateUrl after patching the request |
packages/insomnia/src/ui/components/websockets/action-bar.tsx | Introduced forwardRef and exposed an updateUrl method using useImperativeHandle |
packages/insomnia/src/ui/components/request-url-bar.tsx | Extended ref capabilities to support updateUrl |
packages/insomnia/src/ui/components/panes/request-pane.tsx | Integrated the RequestUrlBar ref to invoke updateUrl after updating the URL |
packages/insomnia/src/ui/components/codemirror/one-line-editor.tsx | Added and implemented setValue to update the one-line editor content |
packages/insomnia/src/common/database.ts | Minor comment update for consistency in terminology |
packages/insomnia-smoke-test/tests/smoke/import-from-url.test.ts | Added smoke tests for both HTTP and WebSocket requests to verify the fix |
packages/insomnia-smoke-test/fixtures/import-from-url.yaml | Provided updated fixture data for the import tests |
packages/insomnia-smoke-test/tests/smoke/import-from-url.test.ts
Outdated
Show resolved
Hide resolved
packages/insomnia-smoke-test/tests/smoke/import-from-url.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the issue where the URL bar does not update after a user imports a URL by adding explicit setValue/setUrl methods to the one-line editors in both the request pane and websocket request pane. Key changes include:
- Adding a ref and setUrl invocation to update the URL in the WebSocketActionBar.
- Introducing the setUrl API in RequestUrlBar for consistent updates.
- Implementing the setValue method in OneLineEditor to preserve the cursor location during updates, along with smoke tests for "Import from URL" flows.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
packages/insomnia/src/ui/components/websockets/websocket-request-pane.tsx | Added a ref to WebSocketActionBar and called setUrl on URL change. |
packages/insomnia/src/ui/components/websockets/action-bar.tsx | Updated to use forwardRef with a new setUrl method. |
packages/insomnia/src/ui/components/request-url-bar.tsx | Introduced setUrl in the imperative handle for URL bar updates. |
packages/insomnia/src/ui/components/panes/request-pane.tsx | Integrated the URL bar ref and setUrl on URL changes. |
packages/insomnia/src/ui/components/codemirror/one-line-editor.tsx | Added setValue to update the editor value while preserving the cursor. |
packages/insomnia-smoke-test/tests/smoke/import-from-url.test.ts | Added smoke tests to verify URL import functionality. |
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
Background
After verifying #2937, query params could update immediately, but the value in the URL bar does not reflect the change.
Root Cause
One line editor is an uncontrolled component. As a result, when the URL is updated, it can't automatically update its value.
Changes
setValue
to the one line editorsetUrl
to the request pane and websocket-request-paneImport from URL
Before
Kapture.2025-04-25.at.10.34.12.mp4
After
Kapture.2025-04-25.at.10.26.12.mp4