Apparent bug in diff/patch logic
yminsky opened this issue · 1 comments
yminsky commented
I have a case where the application of a patch fails with the following exception:
Uncaught TypeError: Failed to execute 'insertBefore' on 'Node': parameter 1 is not of type 'Node'.
Here are gists showing the new and old and the patch. There's a reorder instruction in the patch, which looks a little suspicious.
Original vDOM: https://gist.github.com/yminsky/008d5f563381588c343d5d974fd1040a
New vDOM: https://gist.github.com/yminsky/7b04b3372fc4f851b09e983ed5a80398
Patch: https://gist.github.com/yminsky/a2eb3cd860bb731a4947e488f0dfb869
yminsky commented
Ugh. Just figured out the real issue. It turns out, I had a duplicated key, which lead to the diff/patch algorithm silently doing the wrong thing. Ideally, duplicate keys would be detected and reported as such.