-
Notifications
You must be signed in to change notification settings - Fork 32
VirtualNode renders arrays of children, but crashes hard trying to destroy them when removed. #85
Comments
I can add a jsbin for this, I just wasn't sure if there was a recent Yolk dist available, as reported in #84. |
Ack! I'm pretty sure I know what the issue is. Might get a chance to work on it tonight! Thanks for reporting |
It seems like the problem is that text children are strings (which have no I believe this is only an issue for If it would help, I can submit a fix and a start on |
Yea, except that those text children end up getting wrapped in |
Ah, ok. It sounds like a proper destruction path is needed. |
We can move this conversation elsewhere if needed, but why is each text node wrapped in a |
All text is wrapped in a span so that text could be indexed and moved around. I can just create a span and set the textContent to whatever the text was. I believe that this is what React used to do. It's easier than having to create a |
Thanks! I have some follow up questions but can probably answer those by reading code. |
@brandonpayton or open another issue. If something seems weird, it might be worth a second look. |
I believe that recent changes have fixed this problem. Please rebase, let me know if it is persisting and open a PR with a failing spec! |
Is this fixed now? |
Update: we're also seeing the |
If you write a test, I'll be able to fix it 😉 |
I've submitted a PR that resolves the issue, but like the PR says, I'm not sure if this is a proper fix. It seems that if the jsx component only has a string child that the component destroy method receives the string as a child and tries to call destroy on it... which triggers the error. |
I'm also seeing this same error if I simply try to
Page1 renders, but Page 2 throws the error. This is a contrived example, but it's also how a simple location-based router would work. 😁 |
I bumped into this with some quick-and-dirty code to splat out an array of error messages.
In the example below, we can add an array of N virtual nodes as children by moving the slider, but when we drag the slider back to
0
, and it tries to clean up the nodes, it fails with the error:Uncaught TypeError: c.destroy is not a function
. After the error is thrown, it's like Yolk completely dies. Nothing in the UI responds after that.It looks like this is the offending line of code: https://github.com/garbles/yolk/blob/master/src/VirtualNode.js#L110
The text was updated successfully, but these errors were encountered: