svelte
svelte copied to clipboard
set_custom_element_data: Cannot use 'in' operator to search for 'item' in undefined
Describe the bug
After upgrading from 3.44.2 to 3.44.3 one of the components I work on has broken with this error.
We use svelte to output custom elements.
Reproduction
https://github.com/TommasoAmici/svelte-error
Logs
Uncaught TypeError: Cannot use 'in' operator to search for 'item' in undefined

function set_custom_element_data(node, prop, value) {
if (prop in node) {
node[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;
}
else {
attr(node, prop, value);
}
}
System Info
System:
OS: macOS 11.6
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 706.83 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.1 - /usr/local/Cellar/node@16/16.13.1/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.1.2 - /usr/local/Cellar/node@16/16.13.1/bin/npm
Watchman: 2021.12.20.00 - /usr/local/bin/watchman
Browsers:
Chrome: 96.0.4664.110
Edge: 96.0.1054.62
Firefox Developer Edition: 96.0
Safari: 15.2
Safari Technology Preview: 15.4
npmPackages:
rollup: ^2.61.1 => 2.61.1
svelte: ^3.44.3 => 3.44.3
Severity
blocking an upgrade
This is also blocking for me. Is there any response or update? Thanks!
This is still happening as of 3.46.6
We maintain a library of web components made in Svelte, and this issue is blocking an upgrade for us.
This issue seems to have been introduced with this PR:
https://github.com/sveltejs/svelte/pull/6073
Is there no fix for this yet?
Is someone able to provide a smaller reproduction for this? The linked repo contains 400+ lines of component code and Storybook, which will make it difficult to pinpoint the issue.
I doubt it was introduced by #6073, since a) the error is thrown before the line that PR changed and b) that change was released in 3.38.0, where this issue was introduced with 3.44.3.
Any progress on this issue? As a workaround I am doing for every array refresh instead of list=list
setTimeout(function() {
list=list
},200)
in my project. I have this now on many places in my application - makes current Svelte version not very usable to be honest.
In case this helps anyone we are testing a fix (that has its own issues still) where we replace our repeating component with <svelte:self > and it seems promising
@imperator-maximus @ssuess please see my comment above - we need a smaller reproduction to properly investigate this issue.
I cannot provide one: it seems that this only occurs in very large projects. If projects are smaller I never had such an issue.