workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
But if they keep scrolling to the top, we want to stop rendering the newer messages
2019-03-28T12:04:32.031400
Linda
elmlang
general
since it's expensive to keep all these nodes around
2019-03-28T12:04:41.031600
Linda
elmlang
general
that’s why you will always keep this capped list synced with context
2019-03-28T12:05:04.031800
Ghislaine
elmlang
general
So you basically want to prevent list from changing its width when it is scrolled, is it correct?
2019-03-28T12:05:43.032000
Lynne
elmlang
general
height* if you imagine a vertical list with dynamically sized rows
2019-03-28T12:06:13.032200
Linda
elmlang
general
If you have this capped list, your scrolling would be broken I think
2019-03-28T12:06:43.032400
Linda
elmlang
general
from what i see - 2 concerns get mixed up here. 1. is what content we show to the user. 2. what elements we actually have in the list.
2019-03-28T12:06:57.032600
Yang
elmlang
general
if the user is not at the very bottom of the chat then u dont need to append the new messages to the shown capped list but instead to a recent messages list (hidden) maybe
2019-03-28T12:06:58.032800
Ghislaine
elmlang
general
Ah, okey, so you want the chat window to have the same height all the time?
2019-03-28T12:07:08.033100
Lynne
elmlang
general
Basically it should look like all the content is there to the user, but under the hood it should be efficient in how it is displayed.
2019-03-28T12:07:09.033300
Linda
elmlang
general
Yes. With an inner scroll
2019-03-28T12:07:33.033500
Linda
elmlang
general
Why not fixing it some value then?
2019-03-28T12:07:47.033700
Lynne
elmlang
general
Because the content is dynamically sized.
2019-03-28T12:08:02.033900
Linda
elmlang
general
Look at this demo: <http://bvaughn.github.io/react-virtualized/#/components/List>
2019-03-28T12:08:07.034100
Linda
elmlang
general
and click the "Use dynamic row heights"
2019-03-28T12:08:21.034300
Linda
elmlang
general
Slack does this to display their chat messages
2019-03-28T12:08:57.034500
Linda
elmlang
general
why would the scroll be broken?
2019-03-28T12:09:09.034700
Ghislaine
elmlang
general
Well, this example has fixed height
2019-03-28T12:09:10.034900
Lynne
elmlang
general
`style="box-sizing: border-box; direction: ltr; height: 300px; position: relative; width: 2528px; will-change: transform; overflow: auto;"`
2019-03-28T12:09:27.035100
Lynne
elmlang
general
i’ve used that kind of solution with react but I think this will really over complicate an ELM implementation for such issue
2019-03-28T12:09:50.035300
Ghislaine
elmlang
general
<@Yang> I don't think you'll ever escape the limitations of IEEE 754 floating point in JS. Have you considered a BigDecimal-type library approach e.g. <http://mikemcl.github.io/decimal.js> ?
2019-03-28T12:09:51.035500
Corinne
elmlang
general
<@Lynne> I'm talking about the heights of the row, not the container
2019-03-28T12:10:52.035900
Linda
elmlang
general
I see
2019-03-28T12:11:07.036100
Lynne
elmlang
general
<@Ghislaine> Hmm, so do you think it would need some native js hacking to do this properly in elm?
2019-03-28T12:11:45.036300
Linda
elmlang
general
yeah, I wouldn’t recommend it tbh
2019-03-28T12:12:13.036500
Ghislaine
elmlang
general
Is there another solution? Rendering all the items in the list isn't feasible
2019-03-28T12:12:37.036700
Linda
elmlang
general
I may miss some crucial points of why it has to be done this way but in my imagination there is absolutely no problem doing this in Elm
2019-03-28T12:12:45.036900
Lynne
elmlang
general
you sugest i should buuild the equivalent of this library in elm? or use ports? I cant use ports since this is part of an algoritm that needs to be done in 1 go - i cant wait for async stuff. Still working on the string implementation. Gonna extract that value out of the scientific notation. ex "1e-8" -&gt; 8. since is pretty easy. Gonna see if it passes all my tests. Feels like a hack actually.
2019-03-28T12:13:22.037100
Yang
elmlang
general
For example, I don't understand why it has some inner scroll container with changing height and absolutely positioning elements with top offset
2019-03-28T12:13:33.037300
Lynne
elmlang
general
That's part of the virtualization
2019-03-28T12:13:55.037500
Linda
elmlang
general
Not all the items in the list are really there on the dom
2019-03-28T12:14:09.037700
Linda
elmlang
general
I understand this, but that's very easy to do in Elm: just do not generate `div`s for elements you don't want to show
2019-03-28T12:14:38.037900
Lynne
elmlang
general
gonna take a break. thanks:)
2019-03-28T12:15:24.038100
Yang
elmlang
general
hmm, sorry that I'm not expressing myself properly, and thanks for your help. If you don't generate the divs for elements you don't want to show the size of the scroll container will be incorrect
2019-03-28T12:15:28.038300
Linda
elmlang
general
that’s basically what I said :stuck_out_tongue:
2019-03-28T12:15:29.038500
Ghislaine
elmlang
general
Ah, with dynamic height you won't be able to determine which elements to show correctly
2019-03-28T12:15:36.038700
Lynne
elmlang
general
capped list, show only a subset of data and there u go
2019-03-28T12:15:38.038900
Ghislaine
elmlang
general
Now I understand
2019-03-28T12:15:40.039100
Lynne
elmlang
general
<@Ghislaine> a capped list isn't right, because you want to reserve the space for the rows that aren't rendered
2019-03-28T12:16:11.039300
Linda
elmlang
general
Look at the slack chat, The messages above your messages aren't rendered
2019-03-28T12:16:23.039500
Linda
elmlang
general
but the scroll shows that you are near the bottom. If you move near the top, the messages at the bottom will disappear from the dom. Even though they've disappeared the scroll size of the container and the scroll bar haven't changed
2019-03-28T12:17:08.039700
Linda
elmlang
general
Yep, that's why you need that large container
2019-03-28T12:17:36.039900
Lynne
elmlang
general
Interesting
2019-03-28T12:17:41.040100
Lynne
elmlang
general
android's recycler view does this, ios' list view does this. Angular has a virtual scroll ...
2019-03-28T12:18:56.040300
Linda
elmlang
general
Lot's of folks find this pretty darn useful
2019-03-28T12:19:02.040500
Linda
elmlang
general
Other examples: <https://github.com/domenic/infinite-list-study-group/tree/master/studies>
2019-03-28T12:19:34.040700
Linda
elmlang
general
Well, given the popularity of the tools you have mentioned it is not surprising
2019-03-28T12:19:48.040900
Lynne
elmlang
general
<https://package.elm-lang.org/packages/FabienHenon/elm-infinite-list-view/latest>
2019-03-28T12:20:48.041100
Linda
elmlang
general
Is what I've found for elm
2019-03-28T12:20:53.041300
Linda
elmlang
general
Well, you can use that React component I think and build it in your Elm app via custom element
2019-03-28T12:21:07.041500
Lynne
elmlang
general
Then if you get data in Elm you can send it to port and update your React component with it
2019-03-28T12:21:37.041700
Lynne
elmlang
general
May work
2019-03-28T12:22:40.042100
Lynne
elmlang
general
The Elm package you found supports variable height, but you have to calculate it inside your Elm app. I suppose this is not suitable, right?
2019-03-28T12:24:05.042300
Lynne
elmlang
general
I’ve got to solve this same problem very soon. I’m not really sure how to do it in elm either. I’ve sen that infinite list package you posted, but I can’t tell if it will be easy to work with
2019-03-28T12:24:07.042500
Lorilee
elmlang
general
It's not feasible to precalculate the height of markdown-ish text
2019-03-28T12:25:11.042700
Linda
elmlang
general
It seems really hard to hack this even if you shell out to react
2019-03-28T12:25:29.042900
Linda
elmlang
general
For the item height, there should be some kind of heuristic for a “minimum height”. Say, height of the text
2019-03-28T12:25:40.043100
Lorilee
elmlang
general
it'd be exactly the same in JS as in Elm I think
2019-03-28T12:26:08.043300
Nana
elmlang
general
font size of 14px, means that each message will be at minimum 14px
2019-03-28T12:26:19.043500
Lorilee
elmlang
general
right, but then you have to take into account code blocks, or formatting options. Then take into account user accessibility settings
2019-03-28T12:26:23.043700
Linda
elmlang
general
Well, but as soon as item is rendered first time you can know its height and record it in the app
2019-03-28T12:26:43.043900
Lynne
elmlang
general
yep
2019-03-28T12:26:55.044100
Linda
elmlang
general
As long as the item height is only used as a decision for how soon to load data, it doesn’t have to be exact
2019-03-28T12:26:57.044300
Lorilee
elmlang
general
it used to figure out scrolling height and scroll behavior
2019-03-28T12:27:19.044500
Linda
elmlang
general
Here's a well thought out blurb about this: <https://github.com/bvaughn/react-window/issues/6>
2019-03-28T12:27:44.044700
Linda
elmlang
general
For my current infinite-scroll in an inverted-chat-like-scroll window, I use a mutation observer to change the scroll appropriately when items are added. I wonder if that could be useful. It could be adapted to fire custom DOM events on the scroll container when certain things happen. Lots of JS, but it might be better than a custom element because you could still use elm to display the children.
2019-03-28T12:29:36.045000
Lorilee
elmlang
general
So would it work if you started with some heuristics about default height, and then updated it when the item is rendered by the browser?
2019-03-28T12:29:51.045200
Lynne
elmlang
general
yeah that's a decent strategy.
2019-03-28T12:34:25.045900
Linda
elmlang
general
As you work on this problem, would you mind sharing what works for you? I’m probably going to see what I can do with the mutation observer path.
2019-03-28T12:47:21.046300
Lorilee
elmlang
general
I decided to take a shot at it :slightly_smiling_face: <https://ellie-app.com/56HF2PXcTgga1>
2019-03-28T13:04:37.046500
Nana
elmlang
general
seems to work
2019-03-28T13:04:57.046700
Nana
elmlang
general
sure
2019-03-28T13:18:10.047000
Linda
elmlang
general
hey :smile: passed all my 18 tests :smile: thanks. But i seen 1.45e+33... returns 0. Gonna look more into if thats normal. Maybe my tests are not very good yet. But thanks again.
2019-03-28T14:05:06.047300
Yang
elmlang
general
1.45e33 doesn't have any decimals
2019-03-28T14:20:46.047600
Nana
elmlang
general
no number with a positive exponent should have
2019-03-28T14:22:17.047800
Nana
elmlang
general
1.234567e3 has a positive exponent but definitely has decimals :slightly_smiling_face:
2019-03-28T14:29:02.048000
Janiece
elmlang
general
but it doesn't stay in that format
2019-03-28T14:29:53.048200
Nana
elmlang
general
it converts to 1234.567
2019-03-28T14:30:42.048400
Nana
elmlang
general
<@Yang> I think the only solution that makes sense is to use a small tolerance in `exactFloat` (and maybe rename it to `isApproximatelyIntegral` or something)
2019-03-28T14:31:01.048600
Janiece
elmlang
general
I wonder what the actual heuristic is for how `String.fromFloat` chooses whether to use scientific notation
2019-03-28T14:37:42.048800
Janiece
elmlang
general
But even if it works, it seems like a pretty hacky solution
2019-03-28T14:38:02.049000
Janiece
elmlang
general
<@Janiece> hmm yeah that might work better actually, that way you can avoid the `0.1 + 0.2 == 0.30000000000000004` problem
2019-03-28T15:58:04.049400
Nana
elmlang
general
thank you everybody, ive settled on a solution aproximate to what is in ellie. Plus an using the exactFloat as i had in the code above. It passes all the tests i have built. As <@Rutha> pointed out any e+ number is actually converted to its dot notation when stringified. So spliting by "." works. Feels like a huge hack though..
2019-03-28T16:19:56.049600
Yang
elmlang
general
Hi. I have updated my elm version (npm install elm --global) but have noticed that the elm repl no longer returns the type signatures of functions. Did I mess up somewhere?
2019-03-28T17:12:50.051300
Kent
elmlang
general
(+) returns &lt;function&gt;
2019-03-28T17:13:08.051700
Kent
elmlang
general
When I run elm --version I get 0.19.0
2019-03-28T17:13:52.052300
Kent
elmlang
general
Is there any chance you have a color scheme that's perhaps hiding it?
2019-03-28T17:14:53.053000
Huong
elmlang
general
as in, it show up for me, but it's not super obvious
2019-03-28T17:15:21.053500
Huong
elmlang
general
<@Huong> did not make any change there...
2019-03-28T17:16:11.053900
Kent
elmlang
general
it also does not like it when I type :help
2019-03-28T17:16:35.054500
Kent
elmlang
general
In what way? Also, just to double check, you're running `elm repl`, not `elm-repl`, right?
2019-03-28T17:18:27.055200
Huong
elmlang
general
None
2019-03-28T17:19:06.055300
Kent
elmlang
general
yes I type elm repl
2019-03-28T17:19:24.055800
Kent
elmlang
general
the update command returned the following: npm install elm --global /usr/local/bin/elm -&gt; /usr/local/lib/node_modules/elm/bin/elm &gt; [email protected] install /usr/local/lib/node_modules/elm &gt; binwrap-install + [email protected] updated 1 package in 14.925s
2019-03-28T17:20:21.056400
Kent
elmlang
general
That's what `:help` is supposed to look like, so that's okay
2019-03-28T17:20:43.057100
Huong
elmlang
general
<@Huong> so sorry, you are right...
2019-03-28T17:21:16.057700
Kent
elmlang
general
No worries!
2019-03-28T17:21:21.057900
Huong
elmlang
general
It's weird you're not seeing the full signature, though. Can you verify by copy pasting the output that it really does not have `&lt;function&gt; : number -&gt; number -&gt; number`? :thinking_face:
2019-03-28T17:22:52.058700
Huong
elmlang
general
you are right <@Huong> &lt;function&gt; : number -&gt; number -&gt; number
2019-03-28T17:25:15.059300
Kent
elmlang
general
I don't get how this could have happened?
2019-03-28T17:25:43.060100
Kent