You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trivial sveltekit app with svelte-simple-datatables component.
When starting up, 'npm run dev', shows following error:
TypeError: Cannot read properties of undefined (reading 'length')
at Proxy.each (C:\projects\sk_issue\node_modules\svelte\internal\index.js:1723:31)
at Object.default (/src/routes/index.svelte:77:33)
at eval (/node_modules/svelte-simple-datatables/src/Datatable.svelte:79:17)
at Object.$$render (C:\projects\sk_issue\node_modules\svelte\internal\index.js:1758:22)
at eval (/src/routes/index.svelte:61:143)
at Object.$$render (C:\projects\sk_issue\node_modules\svelte\internal\index.js:1758:22)
at Object.default (root.svelte:43:39)
at eval (/.svelte-kit/runtime/components/layout.svelte:8:41)
at Object.$$render (C:\projects\sk_issue\node_modules\svelte\internal\index.js:1758:22)
at root.svelte:37:37
Comment out component and save. Renders an empty browser page, as expected.
Uncomment the component and save. Renders the data grid correctly.
TypeError: Cannot read properties of undefined (reading 'length')
at Proxy.each (C:\projects\sk_issue\node_modules\svelte\internal\index.js:1723:31)
at Object.default (/src/routes/index.svelte:77:33)
at eval (/node_modules/svelte-simple-datatables/src/Datatable.svelte:79:17)
at Object.$$render (C:\projects\sk_issue\node_modules\svelte\internal\index.js:1758:22)
at eval (/src/routes/index.svelte:61:143)
at Object.$$render (C:\projects\sk_issue\node_modules\svelte\internal\index.js:1758:22)
at Object.default (root.svelte:43:39)
at eval (/.svelte-kit/runtime/components/layout.svelte:8:41)
at Object.$$render (C
The issue here is that the pattern used by svelte-simple-datatables is incompatible with server-side rendering. The binding will take effect, but the store value isn't updated in time for the HTML to be rendered.
It would probably be better if it did something like this:
A workaround would be to initialise rows in the component that uses <Datatable>...
letrows=writable([]);
...but I don't recommend it, honestly, since the SSR output will be missing data, resulting in a flash when the page hydrates. I suggest opening an issue on the svelte-simple-datatables project.
Describe the bug
Trivial sveltekit app with svelte-simple-datatables component.
When starting up, 'npm run dev', shows following error:
TypeError: Cannot read properties of undefined (reading 'length')
at Proxy.each (C:\projects\sk_issue\node_modules\svelte\internal\index.js:1723:31)
at Object.default (/src/routes/index.svelte:77:33)
at eval (/node_modules/svelte-simple-datatables/src/Datatable.svelte:79:17)
at Object.$$render (C:\projects\sk_issue\node_modules\svelte\internal\index.js:1758:22)
at eval (/src/routes/index.svelte:61:143)
at Object.$$render (C:\projects\sk_issue\node_modules\svelte\internal\index.js:1758:22)
at Object.default (root.svelte:43:39)
at eval (/.svelte-kit/runtime/components/layout.svelte:8:41)
at Object.$$render (C:\projects\sk_issue\node_modules\svelte\internal\index.js:1758:22)
at root.svelte:37:37
Comment out component and save. Renders an empty browser page, as expected.
Uncomment the component and save. Renders the data grid correctly.
Reproduction
https://github.com/schechtere/sk_issue
Logs
System Info
Severity
blocking all usage of SvelteKit
Additional Information
No response
The text was updated successfully, but these errors were encountered: