v6: History ⌥-click opens a diff against the current query#4317
Draft
trevor-scheer wants to merge 6 commits into
Draft
v6: History ⌥-click opens a diff against the current query#4317trevor-scheer wants to merge 6 commits into
⌥-click opens a diff against the current query#4317trevor-scheer wants to merge 6 commits into
Conversation
Generic state for rendering a read-only Monaco diff in place of the operation editor. Consumers populate `modifiedQuery`, `label`, and an `onApply` callback; the editor area swaps in a diff component when the overlay is set.
Renders a read-only Monaco side-by-side diff with a header strip and `Apply` / `Cancel` affordances when the editor store's `diffOverlay` is set. ESC dismisses. Models are reused across opens to avoid disposal churn.
When `diffOverlay` is set, the operation editor is hidden via the `hidden` class and `OperationDiffEditor` renders as a sibling. Keeping the operation editor mounted preserves its Monaco model so `Apply` can write back via `queryEditor.setValue()` without remount churn.
Holding the Option/Alt key while clicking a row no longer loads it into the editors; it primes the editor store's `diffOverlay` with the row's query and an `onApply` that does the load when accepted. Plain clicks keep today's behavior. Subtitle updated to advertise the gesture.
Two specs: alt-click opens the diff overlay and `Apply` dismisses it; alt-click opens it and `Cancel` dismisses it.
🦋 Changeset detectedLatest commit: 6d749a5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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
⌥(orAlton non-Mac) and click a history row to open a side-by-side Monaco diff of the current query against the row's query.Applyloads the row into the editors (matching the existing plain-click behavior).CancelorESCdismisses with no changes.OperationDiffEditorcomponent anddiffOverlayslice in@graphiql/reactare generic: any caller can prime them to render a diff in the operation editor area.Test plan
⌥-click the row. Verify the side-by-side diff appears with "Compare with " in the header.Apply. Editor swaps to the row's query.⌥-click again, thenCancel(orESC). Editor stays as you left it.Refs: #4219