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

fix(v2): slot tests fixes #6317

Merged
merged 25 commits into from
May 25, 2024
Merged

Conversation

Varixo
Copy link
Member

@Varixo Varixo commented May 15, 2024

This PR fixes slot e2e tests

packages/qwik/src/core/v2/client/vnode-diff.ts Outdated Show resolved Hide resolved
packages/qwik/src/core/v2/client/vnode-diff.ts Outdated Show resolved Hide resolved
@@ -394,6 +396,43 @@ export const vnode_ensureElementInflated = (vnode: VNode) => {
}
};

export const vnode_getDOMChildVNodes = (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is copy pasted code vnode_getDOMChildNodes , but returns VNodes instead of elements

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we somehow merge the code so that it is not duplicate? I don't want to be fixing the same code twice.

Maybe have an extra argument which you can use if the VNode should be unwraped or not.

) {
const parentNodeIsDefaultNamespace = vnode_isDefaultNamespace(domParentVNode);
const parentIsForeignObject = !parentNodeIsDefaultNamespace
? isForeignObjectElement(vnode_getElementName(domParentVNode))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is the same problem with element name

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a lot of code. Why is all of this needed? Also, can we move all of the code that morphs from one namespace into a different namespace into a separate file?

@Varixo Varixo marked this pull request as ready for review May 21, 2024 15:56
@@ -394,6 +396,43 @@ export const vnode_ensureElementInflated = (vnode: VNode) => {
}
};

export const vnode_getDOMChildVNodes = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we somehow merge the code so that it is not duplicate? I don't want to be fixing the same code twice.

Maybe have an extra argument which you can use if the VNode should be unwraped or not.

@@ -686,6 +725,28 @@ export const vnode_getVNodeForChildNode = (
return child as ElementVNode;
};

// this is trying to find the vnode for the element using Breadth-First Search
export const vnode_getVNodeForElement = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it. It was for finding the q:template element

@@ -931,6 +994,7 @@ export const mapArray_get = <T>(

export const vnode_insertBefore = (
journal: VNodeJournal,
document: Document,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not have to pass document around. Please revert this. If you need to get a hold of element you can always say node.ownerDocument https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument Because that is a rare case I don't mind reading the DOM for that.

) {
const parentNodeIsDefaultNamespace = vnode_isDefaultNamespace(domParentVNode);
const parentIsForeignObject = !parentNodeIsDefaultNamespace
? isForeignObjectElement(vnode_getElementName(domParentVNode))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a lot of code. Why is all of this needed? Also, can we move all of the code that morphs from one namespace into a different namespace into a separate file?

@mhevery mhevery merged commit 4e937f0 into QwikDev:build/v2 May 25, 2024
4 checks passed
@Varixo Varixo deleted the build/v2-slot-tests-fixes branch May 25, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants