Address PR #4110 review feedback: relocate useMonacoSync hook and add tests#4278
Merged
Address PR #4110 review feedback: relocate useMonacoSync hook and add tests#4278
Conversation
Moves useMonacoSync hook from assets/js/hooks (intended for Phoenix LiveView hooks only) to assets/js/log-viewer where it's co-located with its only consumer. Adds component tests that mock Monaco Editor and verify the race condition fix handles logs arriving before, during, and after editor initialization. Tests confirm the fix works when store updates arrive instantly via WebSocket. Includes monaco-editor mock infrastructure in vitest config to prevent module resolution errors during test runs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4278 +/- ##
==========================================
+ Coverage 89.29% 89.32% +0.03%
==========================================
Files 425 425
Lines 19915 19915
==========================================
+ Hits 17783 17789 +6
+ Misses 2132 2126 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Resolve conflict in vitest.config.ts by keeping __mocks__ directory (standard convention) instead of _mocks from main. Updated mock with complete implementation from PR #4283.
stuartc
approved these changes
Jan 15, 2026
Member
stuartc
left a comment
There was a problem hiding this comment.
👌 nice one! I saw that there was two mock directories, I merged the two monaco-editor.ts mocks into __mocks__, I think the dunda pattern is the normal vs _mocks.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR addresses some extra feedback from @stuartc in #4110:
useMonacoSynchook fromassets/js/hooks(intended for Phoenix LiveView hooks only) toassets/js/log-viewerwhere it's co-located with its only consumer.Validation steps
Additional notes for the reviewer
AI Usage
Please disclose how you've used AI in this work (it's cool, we just want to know!):
You can read more details in our Responsible AI Policy
Pre-submission checklist
:owner,:admin,:editor,:viewer)