rtfeldman / elm-spa-example

A Single Page Application written in Elm
https://dev.to/rtfeldman/tour-of-an-open-source-elm-spa
MIT License
3.28k stars 530 forks source link

Rewrite using Browser.element #91

Closed jonsa closed 4 years ago

jonsa commented 4 years ago

Any chance this can be rewritten using Browser.element instead of Browser.application?

I'm starting my journey into the realm of Elm and I was hoping to use this as a reference but I didn't have to dig deep in my background check to find some issues with a core concept used in this repo.

Browser.application is, as far as I can tell, a naive implementation that doesn't work out in the wild. Due to it taking direct control of the body tag it doesn't play along well with some extensions (1) (2). And the sole purpose if this repo is to demonstrate how you would go about building a "real" elm app.

[1] Discussion on discourse [2] https://github.com/elm/browser/issues/66

chevinbrown commented 4 years ago

I don't think that's an option--SPA needs access to URL among other things, which isn't available in Browser.element.

jonsa commented 4 years ago

Actually it is possible, you just have to wire it up yourself as mentioned in Navigation in elements

I even managed to get a proof of concept working with state splitting across pages in this Ellie.

Anyway, I'm closing this issue since I got it working and I'll be able to extract any bits and pieces I might require.

chevinbrown commented 4 years ago

Right...I don't really consider using ports to be the same thing. 😄