sveltejs / svelte

web development for the rest of us
https://svelte.dev
MIT License
79.22k stars 4.17k forks source link

Weird error (when modifying array) at Object.mount at update_keyed_each #6143

Closed m1212e closed 9 months ago

m1212e commented 3 years ago

Hi,

Ive got this error: Uncaught (in promise) TypeError: Cannot read property 'm' of null at Object.mount [as m] (listElement.svelte:31) at mount_component (index.mjs:1412) at Object.mount [as m] (countryList.svelte:25) at insert (index.mjs:1168) at update_keyed_each (index.mjs:1210) at Object.update [as p] (countryList.svelte:23) at update_slot (index.mjs:91) at Object.update [as p] (List.svelte:26) at update (index.mjs:764) at flush (index.mjs:732)

It appears when I'm trying to add or remove stuff from an array. I'm trying to simulate user activity by modifying an array with an interval of five seconds. Every iteration an entry in the array is modified, like a user would have done this in the background. I'cant really trace it down to any specific circumstance, all I know it happens when the underlying array is modified. If you need any further information, let me know. Thanks for you time :)

Conduitry commented 3 years ago

With only a compiled deployed version somewhere, and without the source of your app, there's nothing that anybody can do.

m1212e commented 3 years ago

It's uploaded with the source maps so the code which produces the error can be viewed. I can't reproduce the error in REPL. Mostly because I don't know it's cause and what to include. Would the source code help?

m1212e commented 3 years ago

So I FINALLY tracked it down with simply commenting out code snippets each at a time. I still have no idea why, but this was the cause of the svelte internal error which was thrown: ` {#if index < element.petitions.length - 1}

        {/if}`

The complete component for reference: Pastebin There were no undefined or null errors, all checks were perfectly valid and gave the correct results on logging. No Idea why this happened. Thanks for anyone who took the time :)

m1212e commented 3 years ago

As it seems it's a svelte error or I made a mistake which I'm unable to identify. @Florian-Schoenherr managed to reproduce the error in a REPL so you can take a look easyily: https://svelte.dev/repl/837a844775ec43c98dc769de0d95ed07?version=3.36.0 which is originated in this https://github.com/TheComputerM/svelte-materialify/issues/199 issue.

Florian-Schoenherr commented 3 years ago

@m1212e *This guy managed

m1212e commented 3 years ago

@Florian-Schoenherr Sorry, didn't mean to forget you xD I edited my comment without proof reading it correctly. Surely the credit belongs to you.

Florian-Schoenherr commented 3 years ago

I updated the REPL again, it seems to be some modification error. I set the Interval really low to see the error faster.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Florian-Schoenherr commented 3 years ago

@m1212e does this work now (can't remember what it does)?

m1212e commented 3 years ago

It doesn't. The REPL still throws errors. It was about the interval modifying the list which randomly crashes.

Florian-Schoenherr commented 3 years ago

Ah it was about line 145, mounting a component right there doesn't work, only html elements. So there's a problem with mounting. I would suggest renaming the issue? "Weird error (when modifying array) at Object.mount at update_keyed_each" with or without the words in parens

weepy commented 1 year ago

Is there any resolution or progress on this ? I have the same - intermittent issue - it completely breaks my app, and I'm unable to find a workaround !

weepy commented 1 year ago

As it seems it's a svelte error or I made a mistake which I'm unable to identify. @Florian-Schoenherr managed to reproduce the error in a REPL so you can take a look easyily: https://svelte.dev/repl/837a844775ec43c98dc769de0d95ed07?version=3.36.0 which is originated in this TheComputerM/svelte-materialify#199 issue.

it seems this example no longer works - the api request is not working I think - https://restcountries.eu/rest/v2/all?fields=name;alpha2Code;translations;flag;

dummdidumm commented 9 months ago

closing as outdated and without repro