dillonkearns / elm-pages

Hybrid Elm framework with full-stack and static routes.
https://elm-pages.com
BSD 3-Clause "New" or "Revised" License
657 stars 98 forks source link

Html.Attributes.id "Elm" causes the page to stop loading. #491

Open MartinSStewart opened 5 days ago

MartinSStewart commented 5 days ago

Steps to reproduce:

  1. Check out this branch https://github.com/MartinSStewart/martins-homepage/tree/weird-bug
  2. Start npx elm-pages dev
  3. Open localhost:1234
  4. You should get this error in the console image

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

MartinSStewart commented 5 days ago

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 Html.Attribute.id "Elm" is causing some name collision.

MartinSStewart commented 5 days ago

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

dillonkearns commented 2 days ago

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".

elm-pages - a statically typed site generator 2024-10-07 at 2 28 13 PM

So I'm pretty confused at why this would cause a problem.

MartinSStewart commented 20 hours ago

The generated JS module name usually is called Elm right? Maybe that can somehow have a name collision with DOM ids?