Webpack HMR compatibility: update editInPlace.js#522
Webpack HMR compatibility: update editInPlace.js#522bocharsky-bw merged 2 commits intophp-translation:masterfrom
Conversation
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"
There was a problem hiding this comment.
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
bocharsky-bw
left a comment
There was a problem hiding this comment.
Looks good to me, thank you!
Fix Translation\Bundle\Tests\Unit\Twig\DefaultApplyingNodeVisitorTest::testApply
|
I try to solve failed test on PHP 8.2+. Can you launch the workflow? |
bocharsky-bw
left a comment
There was a problem hiding this comment.
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... |
|
Hi! Can you merge this PR and release it? |
|
Thank you! |
|
Thank you! A new release created: https://github.com/php-translation/symfony-bundle/releases/tag/0.16.1 |
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"