Svelte: Keyed each block always includes transitionManager

Created on 8 May 2018  Â·  6Comments  Â·  Source: sveltejs/svelte

So I was digging around in some generated code and I noticed transitionManager showing up even when no transitions are being used. After tinkering around for a while I discovered it was adding a key to an each block that was including it in the compiled code.

https://svelte.technology/repl?version=2.5.0&gist=c849e83c4bd28ab7b4214611892d4249

This may be needed for cases beyond transitions and it's just the naming that's throwing me off, but at the very least there are some basic cases where it's being included unnecessarily.

I also want to acknowledge that this is prob like 1KB of code minified. So it may not be a concern at all.

p.s. - Svelte is so legit. Thanks for all the work you put into making it even more awesome.

bug

Most helpful comment

All 6 comments

Ah, whoops! This is due to changes made between 2.4 and 2.5, I think. Definitely counts as a bug — thanks

Looks like this was fixed (maybe on purpose? maybe by accident?) in 2.6.0. The keyed-each.ts helper updateKeyedEach no longer depends on the transition stuff, so it's not getting included. However, keyed-each.ts still has import { transitionManager, linear, generateRule, hash } from './transitions'; which looks to no longer be necessary.

However, it does look like transitionManager is still included whenever you use {#await}, whether or not there are transitions.

Yeah, I can confirm that this was fixed in 2.6.0.

Opening #1514 for the issue with {#await} causing transitionManager to always be included, and closing this one, as it's fixed in 2.6.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

juniorsd picture juniorsd  Â·  3Comments

thoughtspile picture thoughtspile  Â·  3Comments

clitetailor picture clitetailor  Â·  3Comments

matt3224 picture matt3224  Â·  3Comments

davidcallanan picture davidcallanan  Â·  3Comments