Skip to content

Conversation

@johan-gorter
Copy link
Contributor

No description provided.

@jvanoostveen jvanoostveen requested a review from Copilot May 8, 2025 12:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR aims to fix an issue where Google Translate interferes with text node updates in the virtual DOM. Key changes include:

  • Adding an extra parameter (oldChildren) to the updateDom function.
  • Updating updateDom calls in updateChildren and createProjection to pass the new parameter.
  • Introducing a try-catch block in updateDom to handle errors during text node replacement.

if (vnode.text !== previous.text) {
let newTextNode = domNode.ownerDocument!.createTextNode(vnode.text!);
parentNode.replaceChild(newTextNode, domNode);
try {
Copy link

Copilot AI May 8, 2025

Choose a reason for hiding this comment

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

In the catch block, 'oldChildren.indexOf(previous)' may return -1 if 'previous' is not found. Consider adding a check to ensure the index is valid before using it to index parentNode.childNodes.

Copilot uses AI. Check for mistakes.
@johan-gorter johan-gorter merged commit 916802a into master May 8, 2025
1 check passed
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.

2 participants