Skip to content

Conversation

@Calvin-LL
Copy link
Contributor

@Calvin-LL Calvin-LL commented Jan 2, 2021

Problem:

I was trying to make a transform that uses replaceNode to replace the currentNode with a new element node.

Since I pass in my transform in TransformOptions["nodeTransforms"], it comes after all the transforms in BaseTransformPreset which includes transformElement.

So

Even though I can create my own codegenNode in my own exit function, I don't think having postTransformElement transform a node that is no longer in the tree is the desired behavior.

Solution:

Instead of using a reference to the node transformElement is first called with, use context.currentNode

@posva
Copy link
Member

posva commented Jan 4, 2021

can you add a test?

@Calvin-LL
Copy link
Contributor Author

can you add a test?

Oops forgot to add a test, just added one

@HcySunYang HcySunYang added the 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. label Mar 29, 2021
@yyx990803 yyx990803 merged commit 0fe567a into vuejs:master Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants