Skip to content

Webpack HMR compatibility: update editInPlace.js #522

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

neothone
Copy link

For HMR compatibility. Fix the javascript error display in console and webpack error overlay : "Failed to execute 'define' on 'CustomElementRegistry': the name "x-trans" has already been used with this registry"

For HMR compatibility.  Fix the javascript error display in console and webpack error overlay : "Failed to execute 'define' on 'CustomElementRegistry': the name "x-trans" has already been used with this registry"
@Copilot Copilot AI review requested due to automatic review settings July 20, 2025 19:12
Copy link

@Copilot 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 addresses a Webpack Hot Module Replacement (HMR) compatibility issue by preventing duplicate custom element registration. The change resolves a JavaScript error that occurs when the custom element "x-trans" is already registered in the CustomElementRegistry during HMR reloads.

  • Adds a guard condition to check if the custom element is already registered before defining it
  • Prevents the "name has already been used with this registry" error in development environments with HMR

Copy link
Member

@bocharsky-bw bocharsky-bw left a comment

Choose a reason for hiding this comment

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

Looks good to me, thank you!

Fix Translation\Bundle\Tests\Unit\Twig\DefaultApplyingNodeVisitorTest::testApply
@neothone
Copy link
Author

I try to solve failed test on PHP 8.2+. Can you launch the workflow?

Copy link
Member

@bocharsky-bw bocharsky-bw left a comment

Choose a reason for hiding this comment

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

Thanks for working on tests fix! It seems your change helped to make tests green. Fairly speaking, I'm not sure why we need that line and why we didn't have problems with that before, but as I see we don't use it anyway so I suppose it's safe to delete it. Any comments?

@neothone
Copy link
Author

Thanks for working on tests fix! It seems your change helped to make tests green. Fairly speaking, I'm not sure why we need that line and why we didn't have problems with that before, but as I see we don't use it anyway so I suppose it's safe to delete it. Any comments?

Yes, I think it's safe too.

I understood that the AST Twig changed with PHP 8.2+ version but honestly I don't know why...

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