Repository navigation
fix: reveal the editor on tab activation and anchor token boxes - #12
Merged
Merged
Conversation
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.
1. Purpose & Motivation
Description
Two renderer bugs, both reported from normal use of the desktop app.
The tab strip went dead under an overlay. The Variables, Settings, Protos and Runner panes cover
the request editor but deliberately keep the tab strip drawn above them, on the promise that
returning to what you were editing is one click and no closing. Clicking a tab moved
activeIdandnothing else, so the pane stayed up and the click appeared to do nothing.
The variable box landed in the wrong place. Clicking a
{{token}}in a plain field opened itsvalue box below the field's left edge instead of below the token. On a URL bar holding six tokens
that is most of the window away from the one that was clicked, and the reader has to work out which
name the value belongs to.
Context & Flow
2. Key Changes
Description
revealEditor()instores/tabs.tsdismisses the overlay, andopenandactivateboth call it.closedeliberately does not: closing a tab handsactiveIdto a neighbour nobody asked to lookat, so uncovering the editor there would be an answer to a question the user did not ask.
anchorRect()inui/TokenOverlay.tsxreads the geometry an<input>cannot give. The pillbackdrop behind the field is a real element, aligned character for character with the input by
construction, and each token is a
<span>the browser has already measured. Pills now carrydata-token-from, so a click can find the pill for the offset it matched and take its horizontalextent. Vertical extent still comes from the field, because the pill is a line box centred inside
it and anchoring to the pill's bottom would tuck the box under the text.
CodeMirror bodies already reported real token rects through
template.ts; this brings plain fieldsin line with them.
Technical Decisions
The dismissal lives in the store, not in
TabStrip. Activation has four entrances — the strip, thesidebar, the command palette and the search results — and a rule stated at one of them is a rule
the other three break. It is called outside
setso a zustand updater never writes to a secondstore and fires its subscribers from inside this one's.
The pill offset is a data attribute rather than a map of refs. Pills are rebuilt from
valueonevery render that can change one, there is one per token, and the only reader is a mouse handler
running long after the paint.
anchorRectclamps to the field and falls back to the field's own rect when the backdrop or thepill is missing, so a token scrolled out of an
overflow: hiddenbackdrop degrades to exactly theprevious behaviour instead of positioning the box off the control.
Critical Modules/Files
packages/desktop/src/renderer/stores/tabs.ts— a cross-store write. Every tab activation in theapp now dismisses the overlay, including restore on workspace switch, which is safe only because
session.tsalready dismisses on a new engine port.packages/desktop/src/renderer/ui/TokenOverlay.tsx—anchorRectdepends on the backdrop beingthe input's immediately preceding sibling.
Controls.tsxholds that invariant in bothFieldand
CellField.Recommended Review Order
packages/desktop/src/renderer/stores/tabs.tspackages/desktop/src/renderer/ui/TokenOverlay.tsxtest/renderer/stores.test.ts3. Verification & Testing
Provide reproducible inputs or steps for each test case, followed by the result and supporting evidence.
With the Variables pane open and two tabs open, click the inactive tab — the request editor replaces the pane and shows that request
Starting state for both runs:
test/fixtures/http-wswithPOST LoginandGET Profileopen,GET Profileactive, Variables pane up with the tab strip above it.Before the fix, clicking
POST Loginmoved the selection but left the Variables pane filling the editor area.After the fix, the same click shows the Login request editor with its URL and JSON body.
With the Settings pane open, open a request from the sidebar — the editor replaces the pane
With the Settings pane open, close a tab from the strip — the pane stays up and the editor is not revealed
Click a
{{token}}near the right end of a long URL — the value box hangs under that token, not under the field's left edgeURL set to
{{http_url}}/api/v1/aev2/transactions?app_ids=241&access={{token}}, with{{token}}painted near the right edge of the field. Before the fix the box dropped from the field's left edge.After the fix the box hangs directly under the clicked token.
Click a different token in the same URL field — the box moves to the newly clicked token
Click a token inside a JSON body — the box still anchors to the token, unchanged from before
4. Impact and Scope
Renderer only.
@preman/coreand the CLI are untouched, and no engine message, workspace file orstored state changes shape.
Behavioural change: any tab activation now closes an open overlay pane. A user who opened Settings,
switched to a tab and expected Settings to still be there will have to reopen it. That is the
reported bug, not a regression.
Three tests added to
test/renderer/stores.test.tscovering activation, open and the closeexception. Full gate clean:
typecheck,lint,format:check, and 1986 tests passing underPREMAN_SKIP_PERF=1, the flagci.ymlsets.