#Router.push() causes error

4 messages · Page 1 of 1 (latest)

cunning crater
#

Hello, I use Router.push() in my project on a page to reload that page with new data.
On this page, the user can interact with inputs etc... that will generate many divs in many different places.
Router.push() is perfectly able to reload the page with new data only if the user hasn't interacted with the inputs and thus created divs.
If the user has interacted with inputs, i will eventually get an error when doing Router.push() (sometimes I don't get an error but the page doesn't reload correctly and some of the divs created by user are still there)

Here's the error that I get :

Unhandled Runtime Error
NotFoundError: Node.removeChild: The node to be removed is not a child of this node
cunning crater
#

I think it has to do with the key attributes of some divs that I generate via Array.map()

cunning crater
#

Ok so I think this happens because I generate element via map() and then I modify these elements depending on user inputs. When I reload the page via Router.push(), I think the app gets lost because what it knows has changed ? Something like that...

#

I noticed that when I generate X elements via map() and then i reload the page with a new value of X that is lower than the previous one. I get the error. Except when all the elements are all the same (it seems)