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

Fix: Unfocus YAML Editor on file change #4775

Merged
merged 2 commits into from
Apr 30, 2024
Merged

Fix: Unfocus YAML Editor on file change #4775

merged 2 commits into from
Apr 30, 2024

Conversation

briangregoryholmes
Copy link
Contributor

@briangregoryholmes briangregoryholmes commented Apr 30, 2024

The Codemirror editor currently ignores updates that happen while the Editor is focused. This is partly a symptom of our invalidation/refetching approach where an update triggered via keystroke from within the editor is eventually received by the editor again via a prop update. Changing that behavior is an ongoing discussion. Because of that conditional, a focused editor would not update its content even when the underlying file being displayed changed.

This PR adds a key prop to the YAMLEditor that unfocuses the editor whenever the prop changes, allowing the conditional check to pass. Implementing it this way, as opposed to wrapping uses of the component in a key block, ensures the logic is documented/captured with the component.

@briangregoryholmes briangregoryholmes self-assigned this Apr 30, 2024
@briangregoryholmes briangregoryholmes added blocker A release blocker issue that should be resolved before a new release Type:Bug Something isn't working labels Apr 30, 2024
@ericpgreen2 ericpgreen2 merged commit f4234c2 into main Apr 30, 2024
4 checks passed
@ericpgreen2 ericpgreen2 deleted the bgh/editor-focus branch April 30, 2024 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker A release blocker issue that should be resolved before a new release Type:Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants