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

bind bugs - supporting onclick attribute, retaining class attribute, walk bug - processDirective correctly removing attributes with 'modifiers', block bug - only remove template element if isConnected #186

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Cactch error in block.remove when parentNode is null
terryaney committed Mar 22, 2023
commit dd9ebaa78dfe49fa383239fe7b3cec6e4162e1f5
15 changes: 13 additions & 2 deletions src/block.ts
Original file line number Diff line number Diff line change
@@ -80,8 +80,19 @@ export class Block {
if (node === this.end) break
node = next
}
} else {
this.template.parentNode!.removeChild(this.template)
} else {
try {
// Possibly related to https://github.com/vuejs/petite-vue/discussions/188 , but at times (not always predictable, so not
// sure what markup/order causes issue) a simple v-for="o in model.searchResultsResources" would cause an error when reactivity
// was changing for searchResultsResources from an array with values to an empty array, parentNode was occasionally null.
if (this.template.isConnected) {
this.template.parentNode!.removeChild(this.template)
}
} catch (error) {
console.log("petite-vue: Unable to remove template");
console.log(error);
console.log(this.template);
}
}
this.teardown()
}