-
Notifications
You must be signed in to change notification settings - Fork 0
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
Slider does not reflect initial value in stream branch #1
Comments
I'm trying to help you. A few considerations before that:
|
Thanks for your help!
|
There was such convention until React breaked that (for good or bad) and start to capitalize their own module name (being not factory, nor class). Now many people seems to prefer capitalized module names. Like Joi, Hapi etc. For now I discovered only that the problem is with numbers, not with position in DOM.
I replaced alot of code according to my own style preferences and continue to mess with it, so feel free to make it on yourself. |
Does it? In the second slider, if I change the initial value to 105 it goes to the correct position in the initial load. |
Oh no wait - it goes to what would be the position of 100 |
Hm, can this be a html problem? As in: you have to set the range first, THEN update the value? If you do it in one go the behaviour is undefined/wrong? It's just weird that both FF and Chrome on win behave the same. |
Yes, it looks like a bug. Sliders have |
All browsers behave the same. So not an issue with HTML implementation. Let's try JSX transform instead of that:
|
Yes it looks like it. I just converted the jsx to h() calls to see if the transformer drops something but the behaviour is the same. So I agree, it seems to be a vdom issue. I'll try to make a simple test case and open an issue with them |
I've got working example :)
|
Oh wow, thanks so much! I just diffed it and tried to find the minimal change that would make my version work - it turns out the startWith on the Label$ (!) does the trick. Change that and everything works. Will have to investigate how this is possible |
Ok, it actually makes sense. startsWith can be on any of the props, if it is on one of the min or max values than it has to be big enough to accomodate the value and maybe different from the default value. What either that or the startsWith on the label do is force a second roundtrip through the stream chain so that the vdom is updated once. Since this is not different from moving the slider or changing the value, it is kind of a workaround - it would be nice if a single roundtrip would suffice. Will try if I can replicate this problem with vdom alone. |
To my experiments |
I opened an issue with virtual-dom about this problem |
It turns out the problem was the order of arguments. If min and max occur before value, everything works fine. I.e. this works:
while this does not, if the initial value is outside the default min max params:
Fixing the argument order as in the first example fixes this bug without the need for the startWith workaround. |
Reopening because order of keys in an object is undefined according to ECMA, this fix is a lucky coincidence that relies on an implementation detail of the js engine. |
In the stream branch, the slider is all the way to the left (= 130 cm) even though the model value is 175 as is indicated by the text field (and a console.log). It should reflect the value of 175 cm.
The text was updated successfully, but these errors were encountered: