Fix Live accept for Elixir templates in lib/#374
Open
heliumbrain wants to merge 1 commit into
Open
Conversation
Wrap and accept search the repo for impeccable variant markers. That search skipped .ex files and the lib/ tree, so Phoenix LiveView markup inside ~H""" blocks never matched and browser Accept returned "Session markers not found". Extend the same EXTENSIONS and searchDirs in live-accept.mjs and live-wrap.mjs. Add a regression test that accepts from lib/my_app_web/components/layouts.ex.
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.
What broke
In Phoenix apps, Live often wraps markup that lives in
lib/**inside a~H"""block in a.exfile. Accept in the browser runslive-accept.mjs, which searches the tree forimpeccable-variants-startmarkers.That search only considered a handful of frontend extensions (
.html,.jsx, …) and directories likesrc/andapp/. It never looked at.exfiles orlib/, so accept returnedSession markers not foundeven though the session was valid.What changed
live-accept.mjsandlive-wrap.mjsnow include.ex,.heex,.exs, and.eex, and search underlib/as well.lib/my_app_web/components/layouts.ex.How I checked
All tests in that file pass (including the new case).
Note
Detector hooks recently gained configurable template extensions (#316 / #347). Live wrap/accept still uses its own hardcoded list; this PR only extends that list for a common Elixir layout. Happy to fold into a broader Live pass if #371 is the better home.
Note
Low Risk
Narrow search-path and file-extension changes to Live CLI helpers, covered by a new accept test; no auth or data-path changes.
Overview
Live accept/wrap no longer miss Phoenix-style markup in
lib/**inside~H"""blocks in.exfiles.live-accept.mjsandlive-wrap.mjsnow scan.ex,.heex,.exs, and.eexand includelib/in their project search paths (alongsidesrc/,app/, etc.), so browser Accept can findimpeccable-variants-startmarkers instead of returningSession markers not found.A regression test accepts a variant from
lib/my_app_web/components/layouts.ex. Live still uses its own hardcoded extension list (not the configurable detector hooks from other work).Reviewed by Cursor Bugbot for commit fabb797. Bugbot is set up for automated code reviews on this repo. Configure here.