-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No Recursive Step - Potential Cause for Failing Key Tests #14
Comments
Exactly. I was thinking about that and tried few things locally. |
Hey @JRJurman, @WebReflection! Heads up! 🎉 Code and tooling is now more organized, cleaned up and linted. There are only 5 assertions that fails, which represents 2 of the keyed tests. And it's probably because that recursion problem. @WebReflection, do you have any ideas for support such thing in I marked the failing tests with Any ideas and thoughts about the speed and tests are welcome! 🐧 |
@olstenlarck I've no idea what is this about, or what you are asking me. Are you using domdiff? Did you file a bug in domdiff for whatever problem you have encountered? |
No, i didn't open issues there, but i will in some point. @JRJurman descibed well what we are talking about and i don't know what to add more to that. I'm not sure where the recursion should happen too. I just can't do currently a demo only using The |
@olstenlarck I can work on those changes on domdiff and we can pull in that fork (until/if the PR gets merged in) |
Okay, I'm in the process of including an extra parameter that allows for a custom isSameNode function, which defaults to '=='. However I noticed this comment by WebReflection
I believe this is the root cause of this issue |
I think 3 calls to I'll think about releasing a major version with breaking signature changes that will probably look like this: futureNodes = domdiff(
parentNode, // where changes happen
currentNodes, // Array of current items/nodes
futureNodes, // Array of future items/nodes (returned)
extras = {
compareNode: (a, b) => a === b,
getNode: node => node,
beforeNode: null
}
); would that work for you needs? |
@JRJurman, exactly. The problem is that i don't know where the recursion can (if can) happen - i'm not so deep into this. It would be enough to allow calling some callback where it detects that there is some more child nodes on some of the items on the list.
@WebReflection, sounds good yea. Too much params aren't good thing, so start
I think so, partially. The In any way, it's good start :) |
domdiff 1.0 is outThe signature has been overly-simplified as such: futureNodes = domdiff(
parentNode, // where changes happen
currentNodes, // Array of current items/nodes
futureNodes, // Array of future items/nodes (returned)
options // optional object with one of the following properties
// before: domNode
// compare(generic, generic) => true if same generic
// node(generic) => Node
); The default for Let me know ho that goes. |
Sweeet! 🎉 I'll try it out. But the recursion is still the thing. Any ideas of how can be done? How you handle such cases in I'm not trying to compete, i'm trying to learn and help |
You can check the asNode function inside Update.js shared object. Components are all based on children by their own. |
FYI this is the part you might be interested in: Basically, the I hope that helps. This is also explained in the domdiff readme.
|
When stepping through the logic for this test
https://github.com/tunnckoCore/demo-minmorph/blob/d587917be0f6e6ae2430a85082fd55b4899758a3/src/app/test-keyed.js#L148-L159
I noticed that we swap a larger chunk of the dom than we need to.
Specifically, here
We dump all of
futureStartNode
in the parentNode, and then later we pop off the second node.In reality, I think we need to recurse down the tree more, and then only swap the TEXT nodes. There doesn't appear to be any recursive step - like in nanomorph, here:
https://github.com/choojs/nanomorph/blob/ccbffcf1f0138a0293f7c71ee6521c7640df7173/index.js#L121-L132
The text was updated successfully, but these errors were encountered: