workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
yes, I didn't go deep into details because I thought that part of information is being implied by sole fact of mentioning `Browser.Application`
2019-04-24T00:45:03.288400
Floy
elmlang
general
There’s not really default behavior as such, though — you implement what to do when a click happens in your `onUrlRequest` handler, and you select what view to show in your `onUrlChange` handler.
2019-04-24T00:45:14.288600
Dede
elmlang
general
I am researching canceling the requests, if background is needed
2019-04-24T00:45:39.288800
Floy
elmlang
general
yes, I know that there isn't
2019-04-24T00:45:52.289000
Floy
elmlang
general
it seems simple first time you look at it
2019-04-24T00:46:04.289200
Floy
elmlang
general
I’m sorry I’m being dense. Is it that you’re trying to cancel unrelated requests, e.g. outstanding http requests, if the view changes?
2019-04-24T00:46:31.289400
Dede
elmlang
general
no problem, I guess I didn't do enough to make my problem clear
2019-04-24T00:46:59.289600
Floy
elmlang
general
and yes, I am trying to cancel the pending requests from view A if user decided to switch to view B
2019-04-24T00:47:17.289800
Floy
elmlang
general
Got it. For that, you might want to record the `tracker` strings of the outstanding requests somewhere on the model and call `cancel` on them in `onUrlChange`.
2019-04-24T00:48:44.290000
Dede
elmlang
general
that would work pretty neat in flat-like TEA but with nested TEA it seems that only possibility to track requests reliable is to always expose, i.e. from my view `init` and `update` function, a list of `tracker` strings for the parent
2019-04-24T00:50:19.290200
Floy
elmlang
general
?
2019-04-24T00:50:30.290400
Floy
elmlang
general
or is it too much?
2019-04-24T00:50:35.290600
Floy
elmlang
general
Alternately, you could add an additional function to your nested components to extract the tracked request names when needed.
2019-04-24T00:51:31.290900
Dede
elmlang
general
(Or even just to cancel them, I suppose.)
2019-04-24T00:51:54.291100
Dede
elmlang
general
I guess I would opt for 2nd solution just because it sounds appealing to me to have some sort of encapsulation of nested views
2019-04-24T00:52:45.291300
Floy
elmlang
general
anyway, if I do access the `tracker` list it makes it parent's responsibility to handle any messages that are created via `Http.cancel` calls which resolves my problem of losing the child from which requests originated
2019-04-24T00:53:54.291500
Floy
elmlang
general
<@Dede> thx for some insights, I suppose I will try some simple implementation now :+1:
2019-04-24T01:00:38.291700
Floy
elmlang
general
:thumbsup:
2019-04-24T01:13:40.292100
Dede
elmlang
general
create-elm-app's default has ServiceWorkers at least.
2019-04-24T02:32:26.292300
Bert
elmlang
general
Another way to handle this is to have the types as they are described here, and in the mixed message divs use e.g. `onClick (LayoutMessage Layout.Add)`, which has the type `Attribute AppMsg`.
2019-04-24T02:36:20.292500
Bert
elmlang
general
i'm importing a local package (L) that requires it's own third party package (R), when i go to compile my main package, it says that L needs R, when i go to install R, it tells me it's already installed, because it's in elm.json
2019-04-24T02:54:30.294100
Ruthann
elmlang
general
'local package'?
2019-04-24T02:55:54.294400
Earlean
elmlang
general
``` "source-directories": [ "src", "local_packages/Alfred/src" ], ```
2019-04-24T02:56:32.294900
Ruthann
elmlang
general
ah, not a package. Just modules
2019-04-24T02:56:54.295800
Earlean
elmlang
general
If this is through `source-directories` - Elm only looks at the main elm.json, and doesn’t even know that other path is a package
2019-04-24T02:56:55.295900
Huong
elmlang
general
ic, so i have to copy all the dependencies into the main elm.json
2019-04-24T02:57:20.296700
Ruthann
elmlang
general
so its dependencies have to be added to the only elm.json elm actually looks at
2019-04-24T02:57:25.296900
Huong
elmlang
general
does it matter if it's a direct or indirect dependency?
2019-04-24T02:57:31.297100
Ruthann
elmlang
general
they need to be direct deps
2019-04-24T02:57:43.297500
Huong
elmlang
general
since your modules use them
2019-04-24T02:57:51.297700
Huong
elmlang
general
cool, thx!
2019-04-24T02:58:43.298800
Ruthann
elmlang
general
and, a little plug for the tool I released yesterday - if you were to run `elm-json solve` on the `elm.json` of this Alfred, it would give you a concrete set of versions that should work
2019-04-24T02:59:38.299000
Huong
elmlang
general
O_o!
2019-04-24T03:00:01.299200
Ruthann
elmlang
general
that's funny :slightly_smiling_face: requests created with `Task` you cannot cancel those :confused:
2019-04-24T03:04:20.299600
Floy
elmlang
general
unless it's possible to cancel the task, which I do not know anything about
2019-04-24T03:04:37.299800
Floy
elmlang
general
<@Dede> any thoughts on that?
2019-04-24T03:04:44.300000
Floy
elmlang
general
so i ran it on the elm.json in the main project and it did the trick doing it on the elm.json inside the local module doesn't give me the dependencies in the main package
2019-04-24T03:05:21.300200
Ruthann
elmlang
general
Correct. I wasn’t very clear - what I meant to say was that you can run in on the `elm.json` of your “local package” to turn those version ranges into concrete versions that you can then install (manually) in your application’s elm.json
2019-04-24T03:07:54.300400
Huong
elmlang
general
cool, thx for that
2019-04-24T03:10:11.300700
Ruthann
elmlang
general
Hey, you cannot cancel `Task`? Or can you ?
2019-04-24T03:13:40.301100
Floy
elmlang
general
kind of...but not really.
2019-04-24T03:18:55.302000
Earlean
elmlang
general
not in a way that it would be generally useful
2019-04-24T03:19:12.302500
Earlean
elmlang
general
so here's funny thing, at least it was funny for me :wink: you can try and cancel http request that was done via `Http.request`, but you cannot do that for `Http.task`
2019-04-24T03:19:42.303100
Floy
elmlang
general
kinda of akward
2019-04-24T03:19:46.303300
Floy
elmlang
general
<@Earlean> do you have an example of doing this in non generally useful way?
2019-04-24T03:20:09.303900
Floy
elmlang
general
<@Earlean> I am just asking because I am curios :slightly_smiling_face:, it'd be nice to see some hack now and then :smile:
2019-04-24T03:25:33.304700
Floy
elmlang
general
True, but then your business logic stays inside the view, which is what you're trying to avoid.
2019-04-24T03:28:20.304800
Dayna
elmlang
general
<@Floy> you can ignore the response
2019-04-24T03:30:21.305800
Nana
elmlang
general
<https://package.elm-lang.org/packages/elm/core/latest/Process#kill> does it, but it's not really complete
2019-04-24T03:30:37.306200
Earlean
elmlang
general
<@Nana> I know that, just have been looking for some hints it's been quite puzzling to analyze that problem in Elm and even more surprising to notice that you can easily cancel `Http.request` but you cannot do the same with `Http.task` thx <@Earlean>
2019-04-24T03:33:05.307700
Floy
elmlang
general
I wonder if perhaps looking at this, this way I mean, is correct
2019-04-24T03:33:24.308200
Floy
elmlang
general
maybe there is no use case and if use decide to use `Http.task` it is because you do not want this request to be interrupted
2019-04-24T03:33:50.308800
Floy
elmlang
general
What's the best approach if I need the higher range of Maybe.maps? Like a Maybe map6, Maybe map7, etc. Should I create those functions, or is there something else I should do?
2019-04-24T03:44:59.309500
Nga
elmlang
general
<@Alicia> The second gif you posted (ssr2.gif) is more useful because it shows the problem precisely. The nodes *are created twice*. That's why you see the HTML fade in twice. If elm hydrated DOM nodes, we would see the fade in animation only once, when the browser renders the HTML the first time, which is before elm takes over. When the elm app starts after the timeout, it appears to wipe out out the existing HTML in the selected container and creates the DOM tree from scratch, triggering the fade in animation a second time.
2019-04-24T03:46:41.309600
Maxwell
elmlang
general
I'm trying to map to a record using its constructor.
2019-04-24T03:47:59.310000
Nga
elmlang
general
Look for the andMap function in the extra package
2019-04-24T03:49:36.311200
Kris
elmlang
general
You could pull in elm-community/maybe-extra which gives you `andMap`, or define it yourself real quick (`andMap = map2 (|&gt;)`). With that, you can ```Just YourRecord |&gt; andMap foo.first |&gt; andMap foo.second |&gt; ... ```
2019-04-24T03:51:16.312600
Huong
elmlang
general
Thank you both :slightly_smiling_face: I'll give that a shot
2019-04-24T03:52:20.313000
Nga
elmlang
general
I want to use some of Ace's functions in elm. Is there any good way?
2019-04-24T03:59:02.313300
Carrie
elmlang
general
is the same .. but it depends on your own style ```Maybe.map YourRecord foo.first |&gt; andMap foo.second```
2019-04-24T04:26:38.314500
Liza
elmlang
general
hmm, get a runtime error of `TypeError: QA is not a function` in my elm application when it is removed from the dom. I have no idea where the error gets "QA" from
2019-04-24T05:32:29.316500
Emilee
elmlang
general
ah, it's the minifier
2019-04-24T05:34:14.316900
Emilee
elmlang
general
well, that's an embarrassing problem for me to solve...^^'
2019-04-24T05:37:47.319700
Emilee
elmlang
general
Is anyone else having problem with Html.textarea and the Grammarly plugin? I'm using Firefox with the Grammarly plugin and the following snippet gives a type error in the console: <https://ellie-app.com/5mzBgtKNrpTa1>. To reproduce without running it locally right-click in the frame with the actual app and click "This Frame" -&gt; "Open Frame in New Tab", then in the new tab resize the textarea (before clicking in it, giving it focus or writing in it), then click in the textarea and start writing. You'll notice that the reversed string is not being written and that if you go to the JS console you should see a "TypeError: domNode is undefined".
2019-04-24T05:38:57.320600
Shaina
elmlang
general
does anyone here have any experience with *removing* an elm app from the dom? i thought i had a good solution, but apparently it still throws errors sometimes (when there is a call to `getElement` running and the element isn't found, it then faceplants when trying to call the error scheduler). this seems to only happen when building optimized though
2019-04-24T05:40:18.322000
Emilee
elmlang
general
It seems like it works in Chrome.
2019-04-24T05:41:18.323000
Shaina
elmlang
general
I responded in <#C0CLGCMMF|testing>. Generally try not to cross post questions, it makes things confusing
2019-04-24T05:59:20.328300
Huong
elmlang
general
Sure thing, I just realized <#C0CLGCMMF|testing> was probably a better place to post
2019-04-24T06:00:03.328500
Bret
elmlang
general
Grammarly and other extensions that mess with the DOM on their own will always run the risk of breaking things like elm
2019-04-24T06:08:46.329700
Danika
elmlang
general
I understand that, but it's really quite unfortunate. I'll try to contact Grammarly, but in the meantime it would be nice if there was something I could do on my end to help fix the problem.
2019-04-24T06:26:32.329900
Shaina
elmlang
general
Not really, the vdom operates on the assumption that nothing else will touch the parts of the real dom it controls.
2019-04-24T06:28:04.331200
Danika
elmlang
general
Hey folks! We released a new stable version of our business product and we're finally moving to elm 0.19 :tada:
2019-04-24T06:46:45.334800
Lilli
elmlang
general
I wanted to take this opportunity to split the app into 2 parts, the api/sdk lib and the browser app. How do you setup your project so that you can import a local module instead of installing it from the elm package repo?
2019-04-24T06:46:51.335100
Lilli
elmlang
general
Actually
2019-04-24T06:48:47.335600
Huong
elmlang
general
``` , Attr.attribute "data-gramm_editor" "false" ```
2019-04-24T06:49:05.336200
Huong
elmlang
general
Adding that to your `textfield` makes Grammarly steer clear of it
2019-04-24T06:49:23.336700
Huong
elmlang
general
once we get enough test coverage, we'll release it in the official repo too, but now it's not ready yet :sweat_smile:
2019-04-24T06:49:47.337300
Lilli
elmlang
general
Well TIL, thats handy!
2019-04-24T06:50:31.337800
Danika
elmlang
general
Excellent! Thanks a lot <@Huong>
2019-04-24T06:53:04.338100
Shaina
elmlang
general
I think you can just mention few entries in `source-directories` of `elm.json`
2019-04-24T06:56:20.338700
Lynne
elmlang
general
Like `src/browser` and `src/api`
2019-04-24T06:56:43.339200
Lynne
elmlang
general
i was searching for a `elm.json` syntax/description, but couldn't find any documentation so far (except few things mentioned in the elm official intro)
2019-04-24T07:00:37.340800
Lilli
elmlang
general
<https://github.com/elm/compiler/blob/0.19.0/docs/elm.json/application.md>
2019-04-24T07:00:49.341000
Lynne
elmlang
general
Here you go :slightly_smiling_face:
2019-04-24T07:00:59.341200
Lynne
elmlang
general
Ah! that's handy :smile: thanks!
2019-04-24T07:01:18.341600
Lilli
elmlang
general
Hmm maybe there should be a JSON Schema defined for this (if there isn't already)
2019-04-24T07:22:08.342300
Corinne
elmlang
general
I don’t think there is, nor do I see who would really be helped by that. If the issue is that creating an `elm.json` file isn’t trivial, I’d have to agree, but I don’t think a schema would help. If you’re interested, though, I released an `elm-json` tool just yesterday that can help with initialising such files (for both applications and packages) as well as with keeping dependencies up to date
2019-04-24T07:26:12.345200
Huong
elmlang
general
<https://github.com/zwilias/elm-json> for the curious.
2019-04-24T07:31:08.345600
Shaina
elmlang
general
That looks very helpful <@Huong>
2019-04-24T07:31:22.346000
Shaina
elmlang
general
JSON Schema can be useful if you're editing the file by hand, and your IDE supports schemas. I too generally prefer a tool to manage the whole process ideally, so might give `elm-json` a try...
2019-04-24T07:35:32.347700
Corinne
elmlang
general
elm-json sounds like the tool i've been waiting for (although i think a lot of this functionality should be moved into `elm` at some point). i think elm doesn't want you editing its `elm.json` by hand, but it's been necessary with 0.19 so far when removing/updating dependencies. a schema might be nice anyway so you can see how the file is supposed to be structured inside your editor
2019-04-24T07:48:52.350500
Emilee
elmlang
general
Okay, I've looked into this a bit more. The error only happens when elm is set to `optimize` (in webpack), and the error is that it can't find the constructor `elm$browser$Browser$Dom$NotFound` in the `getElement` handler
2019-04-24T08:03:55.351000
Emilee
elmlang
general
That;s a painful issue, but not an unknown one
2019-04-24T08:06:02.351300
Huong
elmlang
general
let me see if I can find a trace somewhere
2019-04-24T08:06:17.351500
Huong
elmlang
general
<https://github.com/elm/compiler/issues/1836#issuecomment-463037320>
2019-04-24T08:07:11.351700
Huong
elmlang
general
okay, i've got another piece of information: this happens reliably every time in optimized mode when an element is not found (and never in non-optimized mode). so it has nothing to do with our elements being "unmounted"
2019-04-24T08:07:52.351900
Emilee
elmlang
general
that's at least a bit of a relief for me, since it's not just a problem with our weird setup^^
2019-04-24T08:08:11.352200
Emilee
elmlang
general
so my current option is basically "wait and accept that this will happen" i guess?
2019-04-24T08:16:54.352500
Emilee
elmlang
general
It _might_ be that there’s some weird edgecase where using `identity` in the right place might incluence the callgraph enough to place its definition first, but I’m honestly not sure!
2019-04-24T08:19:13.353400
Huong
elmlang
general
Hey, is there a solution to prevent Http.multipartBody to encode "+" as " " in a Http.stringPart ?
2019-04-24T08:20:28.354200
Tanika