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
Loki/Prometheus: Fix wrong queries executed in split view #60172
Conversation
@gtk-grafana / @matyax before adding tests to this, how do we feel about fixing it like this? I haven't figured out a better way. |
public/app/plugins/datasource/prometheus/components/monaco-query-field/MonacoQueryField.tsx
Outdated
Show resolved
Hide resolved
At first glance, I don't like this approach, which seems to resolve the issue in a hacky way. Since I can't see right now the root cause of the bug, that's all the feedback I have. |
BTW, unfortunately you would not be able to add a regression test for this bug because the editor doesn't render in React tests. |
Btw, I was able to reproduce this with 2 editors in the Monaco Editor Playground. |
Yea, there are several issues reported to https://github.com/microsoft/monaco-editor: https://github.com/microsoft/monaco-editor/search?q=addCommand+instance&type=issues With microsoft/monaco-editor#2947 being the first one since February. So, we could either downgrade to Monaco 0.31.x or use this fix I'd say. |
I was just looking there 👀 |
If this solves the issue, let's go with this. Nice work 🤝 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
Locally verified. |
Thanks Matías! Going to wait for a ✅ from @gtk-grafana / @grafana/observability-metrics and then merge it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, the fix is working locally for me. Thanks for digging into this!
* add context to monaco editors (cherry picked from commit 8356df0)
…rafana#60184) Loki/Prometheus: Fix wrong queries executed in split view (grafana#60172) * add context to monaco editors (cherry picked from commit 8356df0) Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
What is this feature?
Currently the wrong query is executed when multiple Monaco editors are present. This PR adds a
context
value, which has to be true, to the relevanteditor.addCommand
call.Which issue(s) does this PR fix?:
Fixes #60059