Skip to content

feat: use new code editor component in QueryLive#3525

Draft
msmithstubbs wants to merge 4 commits into
Logflare:mainfrom
msmithstubbs:feat/new-code-editor-querylive
Draft

feat: use new code editor component in QueryLive#3525
msmithstubbs wants to merge 4 commits into
Logflare:mainfrom
msmithstubbs:feat/new-code-editor-querylive

Conversation

@msmithstubbs

@msmithstubbs msmithstubbs commented May 26, 2026

Copy link
Copy Markdown
Contributor

Replace the LiveMonacoEditor component in QueryLive with our own component wrapper.

Key differences:

  • A simpler functional component instead of a live component
  • The editor does not push events to LiveView. Instead, it syncs content with a hidden field that uses regular phx-* bindings to interact with the server.
  • Expanded JavaScript unit testing of the hook. With no need for a live view process, these tests focus on the DOM interaction.
  • Monaco JavaScript dependencies vendored directly into the repository
  • Update Monaco editor to latest version 0.55.1
CleanShot 2026-05-29 at 15 03 58@2x
CleanShot.2026-05-29.at.15.01.51.mp4

Monaco editor is independent of LiveView

Untitled-2026-05-26-0715

The key difference in this architecture is that the Monaco editor doesn't send update events to the live view process.

The Monaco editor updates a hidden textarea field and triggers a form-change event to the live view, matching the standard form-backed LiveView setup. The LiveView can update the form, and the Monaco editor will receive changes from the form field itself.

This simplifies the implementation and makes it much easier to test: we can test the Monaco DOM interactions with JS unit tests, and form interactions in LiveViewTest.

PR Stack

This is part of a sequence of PRs that are intended to be merged in order:

or search 🔍 is:pr O11Y-1543 sort:created-asc

Part of O11Y-1684 and O11Y-1543

Comment on lines 204 to 205
socket.assigns.endpoints,
socket.assigns.alerts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Kept endpoints and alerts in assigns to match the current implementation but could just fetch them from Cache if it is fast enough.

@msmithstubbs msmithstubbs force-pushed the feat/new-code-editor-querylive branch 2 times, most recently from 7f5bbf2 to 35a396b Compare May 29, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant