-
Notifications
You must be signed in to change notification settings - Fork 16
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
Update from Elm 0.18's Navigation.program to Elm 0.19's Browser.application #38
base: master
Are you sure you want to change the base?
Conversation
Hey @jerith666, if you want any help with this, I would like to see this upgraded. |
Great! If you want to propose updates to the docs and examples, I can review and hopefully we can wrap this up! :) FWIW I've been using git submodules to work with this in 0.19 while I await its completion. See jerith666/elbum@49873d6. It might be nice to see a second example of this working in a real app, via that mechanism, before we declare it done too. |
Okay.
…On Wed, Jan 16, 2019 at 9:13 PM Matt McHenry ***@***.***> wrote:
Great! If you want to propose updates to the docs and examples, I can
review and hopefully we can wrap this up! :)
FWIW I've been using git submodules to work with this in 0.19 while I
await its completion. See ***@***.***
<jerith666/elbum@49873d6>.
It might be nice to see a second example of this working in a real app, via
that mechanism, before we declare it done too.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#38 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAXI_S38RsCwt9FuKjWDn9g0CGqF7I4ks5vD_h6gaJpZM4ZZZvG>
.
|
I've been shifted to other work, so I have not had a chance to look at this
yet.
On Wed, Jan 16, 2019 at 9:24 PM Andrew Lenards <[email protected]>
wrote:
… Okay.
On Wed, Jan 16, 2019 at 9:13 PM Matt McHenry ***@***.***>
wrote:
> Great! If you want to propose updates to the docs and examples, I can
> review and hopefully we can wrap this up! :)
>
> FWIW I've been using git submodules to work with this in 0.19 while I
> await its completion. See ***@***.***
> <jerith666/elbum@49873d6>.
> It might be nice to see a second example of this working in a real app, via
> that mechanism, before we declare it done too.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#38 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAAXI_S38RsCwt9FuKjWDn9g0CGqF7I4ks5vD_h6gaJpZM4ZZZvG>
> .
>
|
I realize this PR has been dormant for a long while, so maybe the momentum to land this is no longer there. However, I recently revived an old Elm 0.17 app and upgraded it first to 0.18 and then to 0.19.1 (using @jerith666 's fork as a submodule as suggested), so I thought I might share a bit of feedback around that. I had a bit of a hard time figuring out why I started with providing a no-op handler there, that is I think it would be more intuitive if at least internal This directly wraps internal url requests into a I'm undecided on external An alternative solution would be leave the Of course, it is totally possible that I am holding this wrong and missing something obvious. |
Thanks for the feedback! I just looked through how I have I do still need to see the external URLs in my app, and I think the way you've done that with If it's okay, I'll take some time to rework my app to use this, and confirm my intuition. If it turns out the way I expect, I'll add your change to this PR! |
Just an update: I still think this will work, but it needs an important tweak. As you've implemented it, there's nothing that causes the |
Finally got some time to update the examples & README, and squash down to a single commit with a sensible message. Please take a look and let me know if I've missed anything! |
…cation * adapt to the new Browser.application API in the following ways: * mirror the two-phase handling of URL changes in Browser.application's 'onUrlRequest' and 'onUrlChange' by bifurcating the RouterMsg variant of WrappedMsg into RouterMsgOnUrlChange and RouterMsgOnUrlRequestInternal variants. * add a slot to RouterModel to store the new Browser.Navigation.Key, and in the update function, use it to invoke Browser.Navigation.pushUrl in response to a urlRequestInternal. * create a new 'onExternalUrlRequest' function for the user to implement, since RouteUrl can handle internal requests for the user, but can't do anything sensible with external requests (as suggested by @basti1302). * eliminate the distinction between App and AppWithFlags, and all related duplication, as there is no variant of the new Browser.application that doesn't support flags. * make UrlChange more strongly typed, mirroring the structure of the Url.Url record type from elm/url, and rework the way UrlChanges are converted to Cmds with a new 'apply : Url -> UrlChange -> Url' function. * update all examples to work with the new API and 0.19 generally * include work-arounds for a couple of elm/url bugs (elm/url#37 and elm/url#17) * store the base path in ExampleViewer.Model to illustrate absolute path requirement of UrlChange * build the examples with '--debug' so users can get an idea for how they work under the hood * update README * remove references to complementary packages that aren't compatible with 0.19 (which is all of them) * remove the RouteUrl.Builder module and the use of the sporto/erl package, as this functionality is now largely provided by elm/url. * remove the older RouteHash module, as it was only present to ease the transition from elm-route-hash to elm-route-url. also remove example code illustrating its use.
I think you got everything in your well-crafted commit message. Thanks for that. Also, just want to note that I appreciate the |
, button [ onClick Increment ] [ text "+" ] | ||
] | ||
|
||
|
||
countStyle : Attribute any | ||
countStyle : List (Attribute any) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is in the original, but I really like the use of any
as the name of a type variable.
Browser.application
and using newelm/url
core APIRouteHash
RouteUrl.Builder
fixes #37.
adapt to the new Browser.application API in the following ways:
mirror the two-phase handling of URL changes in
Browser.application's 'onUrlRequest' and 'onUrlChange' by
bifurcating the RouterMsg variant of WrappedMsg into
RouterMsgOnUrlChange and RouterMsgOnUrlRequestInternal variants.
add a slot to RouterModel to store the new Browser.Navigation.Key,
and in the update function, use it to invoke
Browser.Navigation.pushUrl in response to a urlRequestInternal.
create a new 'onExternalUrlRequest' function for the user to
implement, since RouteUrl can handle internal requests for the
user, but can't do anything sensible with external requests (as
suggested by @basti1302).
eliminate the distinction between App and AppWithFlags, and all
related duplication, as there is no variant of the new
Browser.application that doesn't support flags.
make UrlChange more strongly typed, mirroring the structure of the
Url.Url record type from elm/url, and rework the way UrlChanges are
converted to Cmds with a new 'apply : Url -> UrlChange -> Url'
function.
update all examples to work with the new API and 0.19 generally
include work-arounds for a couple of elm/url bugs
(Two "?"s added to url elm/url#37 and
Allow ignoring the path / Just parsing query parameters elm/url#17)
store the base path in ExampleViewer.Model to illustrate absolute
path requirement of UrlChange
build the examples with '--debug' so users can get an idea for how
they work under the hood
update README
with 0.19 (which is all of them)
remove the RouteUrl.Builder module and the use of the sporto/erl
package, as this functionality is now largely provided by elm/url.
remove the older RouteHash module, as it was only present to ease
the transition from elm-route-hash to elm-route-url. also remove
example code illustrating its use.