obesecoder
obesecoder
SSolidJS
Created by obesecoder on 6/18/2024 in #support
DOMException *sometimes* after changing element order
I have a solid-js website that populates an html table with data, using a <For /> to render, with a createResource() signal as the source for the list. After the data is rendered, the user can sort the table, which directly changes the order of the table rows in the DOM. When the refetch() is called on the resource, often a DOMException is thrown Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node. Here is a sandbox reproduction of the issue:
1. Click the Sort Data button 2. Click the Fetch Data button If you refresh the page, and do the fetch first, then sort, then fetch .. you can see that it does not throw in this case I have a feeling this has something to do with JSX and how the DOM is changed on a refetch ... like it has a reference to the old nodes before sorting Please help ... sorting the data inside of the createResource fetcher routine is not really an option here, as the sorting functionality is part of a much larger vanilla web-component that augments the plain html tables for us.
4 replies