Skip to content
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

Match CodeMirror mode to value type on initialization #13708

Merged

Conversation

marshmalien
Copy link
Member

SUMMARY

Fixes #13675

Update VariablesField to check the field.value before setting the mode to YAML or JSON.

The bug was caused by a brief, initial mismatch between the mode and field.value. When the variables field is in YAML mode, we set lastYamlValue to the current field value, assuming the value is in YAML. If the user does not edit the variables field in JSON mode, then switches to YAML mode, we set the YAML value back to lastYamlValue to prevent the field from unnecessarily expanding YAML expressions. Whenever the initial value was a json string AND mode === yaml, this would break the conversion since lastYamlValue was set to a json string instead of a yaml value.

RECORDINGS
edit_form_variables_toggle.mov
Screen.Recording.2023-03-16.at.11.00.21.AM.mov
ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • UI

Copy link
Member

@keithjgrant keithjgrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@vishsanghishetty vishsanghishetty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verified by QE, merging

@vishsanghishetty vishsanghishetty merged commit 3e6e046 into ansible:devel Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Constructed Inventory- Ace Editor- JSON => Yaml conversion not functioning on variable edit
3 participants