-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Html.Attributes.id "Elm" causes the page to stop loading. #491
Comments
I've narrowed it down to this view : App Data ActionData RouteParams -> Shared.Model -> Model -> View (PagesMsg Msg)
view app _ model =
{ title = ""
, body = Ui.el [ Ui.id "Elm" ] Ui.none
} I think what is happening |
I've converted Index.elm into a SSCCE for this issue. It's the latest commit on https://github.com/MartinSStewart/martins-homepage/tree/weird-bug |
Thanks for the issue and SSCCE! I was trying to look through the codebase for anything that references an "elm" or "Elm" HTML id, but couldn't find it 🤔 I also notice that the elm-pages docs site, for example, doesn't have any elements with the ID "elm" or "Elm". So I'm pretty confused at why this would cause a problem. |
The generated JS module name usually is called Elm right? Maybe that can somehow have a name collision with DOM ids? |
I ran your SSCCE, and also ran into an error, although not the same as yours.
But I can explain why that one happens! First, you are on the right track that DOM ids can cause conflicts with JS things with the same name. Watch: ![]() The DOM has a feature where if there’s an element on the page with an In your SSCCE, there’s The script tag for the Elm code has <script defer src="/elm.js" type="text/javascript"></script>
Elm supports ![]() Now on to My guess is that something similar happened when you got the If elm-pages really want to solve this, it should be possible. Either by not relying on |
Yup, this is what I did. Thanks for the explanation of what is going wrong. I don't mind having to change id names. The real issue is just that it isn't obvious what to do when this error appears, but given this is probably a very rare bug, maybe it's not worth doing anything about it. |
Yeah, it is unfortunate. I would consider this more of an Elm thing than an elm-pages thing. Certainly not ideal and I do try to smooth over edges as much as possible, but seems like probably a lot of effort for a pesky little thing so this one is not at the top of my personal to do list. Happy to accept a PR as always though if someone has an elegant fix for this in the future. |
Either way though, great to have this placeholder and explanation in case anyone else is scratching their heads in the future. So thank you both! |
Steps to reproduce:
npx elm-pages dev
localhost:1234
Note that this issue goes away if you go to the previous commit on the branch.
I'm on Windows, Firefox, and I can trigger this error both on Lamdera 1.3 and 1.2.2
The text was updated successfully, but these errors were encountered: