Skip to content
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

v2.2.2 -> v2.2.3 Conditional components generate errors? #2990

Open
1 task done
thequailman opened this issue Nov 13, 2024 · 2 comments
Open
1 task done

v2.2.2 -> v2.2.3 Conditional components generate errors? #2990

thequailman opened this issue Nov 13, 2024 · 2 comments
Assignees
Labels
Area: Core For anything dealing with Mithril core itself Status: Needs reproduction For issues that lack a demo or example that reproduces the unexpected behavior in question

Comments

@thequailman
Copy link

thequailman commented Nov 13, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Mithril.js Version

v2.2.3+

Browser and OS

Happy dom

Project

No response

Code

N/A

Steps to Reproduce

Upgrade mithril from 2.2.2 to 2.2.3+

Expected Behavior

No errors/breaking of rendering.

Observed Behavior

I see these errors on a bunch of my tests after upgrading from 2.2.2 to 2.2.3 (problem still exists in 2.2.10), and it breaks rendering. This does NOT happen at all on 2.2.2.

TypeError: Cannot destructure property 'nextSibling' of 'dom' as it is null.
    at domFor (/node_modules/mithril/render/domFor.js:7:10)
    at domFor.next (<anonymous>)
    at removeDOM (/node_modules/mithril/render/render.js:653:13)
    at removeNode (/node_modules/mithril/render/render.js:613:4)
    at updateNodes (/node_modules/mithril/render/render.js:294:26)
    at updateElement (/node_modules/mithril/render/render.js:459:4)
    at updateNode (/node_modules/mithril/render/render.js:409:15)
    at updateNodes (/node_modules/mithril/render/render.js:295:11)
    at updateElement (/node_modules/mithril/render/render.js:459:4)
    at updateNode (/node_modules/mithril/render/render.js:409:15)

stderr | src/lib/components/component.test.ts > Component
DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
    at HTMLDivElement.[insertBefore] (file:////node_modules/happy-dom/src/nodes/node/Node.ts:641:10)
    at HTMLDivElement.[insertBefore] (file:////node_modules/happy-dom/src/nodes/element/Element.ts:1304:57)
    at HTMLDivElement.insertBefore (file:////node_modules/happy-dom/src/nodes/node/Node.ts:422:43)
    at HTMLDivElement.[insertBefore] (file:////node_modules/happy-dom/src/nodes/node/Node.ts:625:10)
    at HTMLDivElement.[insertBefore] (file:////node_modules/happy-dom/src/nodes/element/Element.ts:1304:57)
    at HTMLDivElement.insertBefore (file:////node_modules/happy-dom/src/nodes/node/Node.ts:422:43)
    at insertDOM (/node_modules/mithril/render/render.js:564:35)
    at createFragment (/node_modules/mithril/render/render.js:110:3)
    at createNode (/node_modules/mithril/render/render.js:67:15)
    at createComponent (/node_modules/mithril/render/render.js:161:4)

This could be a happy-dom issue, but I'd love to be able to provide a reproducible thing that doesn't involve a ton of libraries. Is there any logging I could add to render.js or domFor.js to narrow down the issue or what el it's acting on?

Context

No response

@thequailman thequailman added the Area: Core For anything dealing with Mithril core itself label Nov 13, 2024
@dead-claudia dead-claudia added the Status: Needs reproduction For issues that lack a demo or example that reproduces the unexpected behavior in question label Nov 13, 2024
@dead-claudia
Copy link
Member

Could you provide code to reproduce?

@kfule
Copy link
Contributor

kfule commented Nov 16, 2024

DOMException: Failed to execute 'insertBefore' on 'Node'

It seems there was an issue a while ago regarding insertBefore of happydom.
I don't know if it's the same issue, though.

capricorn86/happy-dom#1429

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Core For anything dealing with Mithril core itself Status: Needs reproduction For issues that lack a demo or example that reproduces the unexpected behavior in question
Projects
None yet
Development

No branches or pull requests

3 participants