-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
KVv2 json cursor jumps on "enter" #27569
Open
Monkeychip
wants to merge
8
commits into
main
Choose a base branch
from
ui/VAULT-28328/kv-cursor-jump-saga-cont
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
CI Results: failed ❌ |
Build Results: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport/ent/1.15.x+ent
Changes are backported to 1.15.x+ent
backport/ent/1.16.x+ent
Changes are backported to 1.16.x+ent
backport/1.17.x
hashicorp-contributed-pr
If the PR is HashiCorp (i.e. not-community) contributed
regression
Used to indicate possible regressions between versions
ui
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.
THIS BREAKS all the things. Going another route, stay tuned.
Description
Fixes Issue #27524
It's caused by codemirrors .setValue—see here. Granted, we're on an older version, so here's the setValue we're actually using (I've tested the updated codemirror, it doesn't fix this).
Here's my theory of what's happening:
onChange
.codemirror-modifier
modify function here.namedArgs.content
has been parsed, before thethis._editor.getValue()
has been. Meaning that for a whitespace value like "enter" we're comparing:{foo: 'beep'}
vs{ "foo": "beep" /n }
And this is the 🖤 of the problem. So this only happens on whitespace events and on KVv2. I've been over various solutions and think this one is the safest in regards to regressions and backporting. It more or less ensures that we're comparing the same values before hitting setValue.
Note: this only happens to KVv2 because it's the only use case where we mess with the json value
onChange
. The other JsonEditor instances (policies, cubbyhole, etc) all parse the json valueonSave
like workflows. It's not an easy fix to do move KVv2 to parse onSave and frankly I'm nervous about causing other regressions in that secret engine by changing a pattern like that. There have been several prs on the json toggle area just for KVv2 for strange behavior. I'm fairly certain the new "Reveal values/masking" on toggle depends on the onChange event as well because it hits this setValue event and updates the values from masked to what they really are.TODO only if you're a HashiCorp employee
getting backported to N-2, use the new style
backport/ent/x.x.x+ent
labelsinstead of the old style
backport/x.x.x
labels.the normal
backport/x.x.x
label (there should be only 1).of a public function, even if that change is in a CE file, double check that
applying the patch for this PR to the ENT repo and running tests doesn't
break any tests. Sometimes ENT only tests rely on public functions in CE
files.
in the PR description, commit message, or branch name.
description. Also, make sure the changelog is in this PR, not in your ENT PR.