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(NodePart): factory method created to help us when creating NodePart introduced due to scope hoisting problem with ParcelJS #954

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/lib/parts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@ export class AttributePart implements Part {
}
}

/**
* Creates a new NodePart instance
* Introduced because of scope hoisting problem with parcel js
* https://github.com/parcel-bundler/parcel/issues/3172
*/
function nodePartFactory(options: RenderOptions) {
return new NodePart(options);
}

/**
* A Part that controls a location within a Node tree. Like a Range, NodePart
* has start and end locations and can set and update the Nodes between those
Expand Down Expand Up @@ -308,7 +317,7 @@ export class NodePart implements Part {

// If no existing part, create a new one
if (itemPart === undefined) {
itemPart = new NodePart(this.options);
itemPart = nodePartFactory(this.options);
itemParts.push(itemPart);
if (partIndex === 0) {
itemPart.appendIntoPart(this);
Expand Down