WIP: Add support for Fragments#1080
Conversation
|
|
||
| }); | ||
|
|
||
| /** Fragmetn is a "passthrough" component which only has the key attribute |
There was a problem hiding this comment.
Thanks for spotting this :)
|
Tests are passing, even for array returns 🎉 Still need to figure out a cleaner to integrate all this. |
| } | ||
| } | ||
| else { | ||
| updateChild(dom, child, f); |
There was a problem hiding this comment.
Likely a small performance loss, because updateChild is not inlined anymore. Need to measure this.
There was a problem hiding this comment.
Compared with master my measurements don't show much differences. The empty diff test shows the most difference.
| master | branch | |
|---|---|---|
| empty diff | 89503/s (30 ticks) | 84007/s (31 ticks) |
| repeat diff | 11707/s (228 ticks) | 11373/s (228 ticks) |
| large VTree | 43276/s (62 ticks) | 43877/s (58 ticks) |
| style/prop mutation | 19974/s (133 ticks) | 19745/s (132 ticks) |
| SSR Hydrate | 1384/s (1962 ticks) | 1364/s (1903 ticks) |
There was a problem hiding this comment.
Fixed the slowdown of the empty diff check. Problem was the Array.isArray check at https://github.com/developit/preact/pull/1080/files#diff-a0896fa5d65b1d80ca4d496badbae50fR106
| } | ||
|
|
||
| if (Array.isArray(vnode)) { | ||
| return vnode.map(x => idiff(dom, x, context, mountAll, componentRoot)); |
There was a problem hiding this comment.
TODO: Don't rely on Array.map
| test(<div><Comp /></div>); | ||
|
|
||
| expect(scratch.innerHTML).to.equal('<div><span>foo</span>bar</div>'); | ||
| }); |
There was a problem hiding this comment.
TODO: Add test for keyed Fragments
|
Decided to remove straight array returns, because they are making everything needlessly complex. Just using Fragments for this leads to the same result, so introducing the additional complexity is not worth it. |
|
Any news on this? Is it only awaiting approval? |
|
Any update on this guys ? |
|
Any update? |
|
Any news? |
| if (parent && ret.parentNode!==parent) parent.appendChild(ret); | ||
| if (parent) { | ||
| // append the element if its a new parent | ||
| if (ret instanceof Array) { |
There was a problem hiding this comment.
https://jsperf.com/instanceof-array-vs-array-isarray/33
can you try ret.constructor === Array?
its seems faster on many browsers
(you have two other instances of this in this file)
|
@marvinhagemeister there is an issue with your PR: line 203, in the code, there is |
|
Hi @Ayc0. @marvinhagemeister If my assumption is right, can we close this pr with a comment/link to your comment in #946 ? |
|
@Kanaye perfect then 👌 |
tldr; Fragments are part of the next major release 🎉 🎉Sorry for being radio silence on this PR. We do have merged Our current architecture relies on a @Kanaye yep this can be closed 👍 @Ayc0 you're right. |
|
Hi @marvinhagemeister, any chance to have a date for this next major release ? I searched on the whole website but did not manage to find this information. Thx |
|
@benjamin-schneider No we don't have set our eyes on a specific date. We're getting closer and closer each week but it's hard to predict an actual release date from that. Rest assured that all the hard work has been completed and we're currently working on getting all the ecosystem tools up to date (devtools, debug, render-to-string, etc). You're right that this information can't be found on our website. |
|
I waiting this feature too! |
|
Any updates now on the date for the next major release? |
|
@Eli-Nathan just tweeted an update on the current state of Preact X: https://twitter.com/marvinhagemeist/status/1082329232322252800 |


This is really rough draft, but I thought to develop more in the open to get the ball rolling. The last test is still failing and the code feels really hacky, but hey it's a start 🎉
Fixes #946 .