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

Streams `toString` / `valueOf` behaviour clashes with DOM diff early exit #2150

Closed
barneycarroll opened this Issue May 14, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@barneycarroll
Copy link
Member

barneycarroll commented May 14, 2018

Thanks @cmnstmntmn for discovering this: streams semi-automatic string coercion behaviour conflicts with virtual DOM diffing algo, which will skip diffing a stream reference in place of a VDOM node. Here's an example: interpolating value without explicitly invoking it will ensure the text node forever stays at the initial value.

It was my idea to give streams toString behaviour, and in hindsight I think it was a terrible mistake: the effort saved through avoiding those parentheses unleashes a world of ambiguity. I had already convinced myself the original idea was conceptually bad in #2050, but this points to a problem caused by opinionated tolerance in many places - vnode normalisation should also be fixed to cater for the other end of this issue.

@pygy

This comment has been minimized.

Copy link
Member

pygy commented May 14, 2018

Oooh yeah, let's ditch that!

@spacejack

This comment has been minimized.

Copy link
Contributor

spacejack commented May 15, 2018

Yeah I got burned similarly today. I had changed a boolean var into a stream, and in my view I had:

isCondition ? m('.foo) : m('.bar')

It's especially hazardous when refactoring things into streams. And Typescript can't do much with valueOf either so it won't help out.

barneycarroll added a commit that referenced this issue May 15, 2018

@pygy pygy closed this in e1a5089 May 15, 2018

@porsager porsager referenced this issue Sep 14, 2018

Merged

Rewrite stream #2207

10 of 11 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment