Skip to content

Remove ComponentAttributeFactory and inject EscaperRuntime directly - #2749

Merged
fabpot merged 1 commit into
symfony:2.xfrom
smnandre:component-attribute-escaper
May 19, 2025
Merged

Remove ComponentAttributeFactory and inject EscaperRuntime directly#2749
fabpot merged 1 commit into
symfony:2.xfrom
smnandre:component-attribute-escaper

Conversation

@smnandre

Copy link
Copy Markdown
Member

Replaces the ComponentAttributesFactory with direct usage of the EscaperRuntime from Twig

Inject EscaperRuntime in ComponentAttributes

  • Replaced ComponentAttributesFactory with Twig\Environment and EscaperRuntime in AddLiveAttributesSubscriber, LiveComponentHydrator, and ChildComponentPartialRenderer, ensuring ComponentAttributes is instantiated with the necessary EscaperRuntime.
  • Updated the ComponentAttributes constructor to require EscaperRuntime directly, removing the deprecated HtmlAttributeEscaperInterface.

Remove ComponentAttributeFactory

  • Removed all references to ComponentAttributesFactory and its related logic across the codebase
  • Adjusted unit and integration tests to reflect the removal of ComponentAttributesFactory

Dependency Updates

  • Updated symfony/ux-twig-component dependency in composer.json to version ^2.25.1

Documentation Updates

  • Added a new entry in the CHANGELOG.md for version 2.25.1

@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label May 19, 2025

@Kocal Kocal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very few comments, otherwise it looks nice to me 🤩

Comment thread src/TwigComponent/CHANGELOG.md Outdated
Comment thread src/LiveComponent/src/Util/ChildComponentPartialRenderer.php Outdated
@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels May 19, 2025
Comment thread src/TwigComponent/src/ComponentAttributes.php
Comment thread src/TwigComponent/CHANGELOG.md Outdated

@nicolas-grekas nicolas-grekas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Simplicity FTW 🚀
just minor comments to fix before merge

@smnandre

Copy link
Copy Markdown
Member Author

(remaining fabbot failures unrelated / false positives)

@smnandre

Copy link
Copy Markdown
Member Author

LiveComponent dev / 8.4 failures caused by TypeInfo deprecation / unrelated to this PR

Capture d’écran 2025-05-19 à 13 19 14

@fabpot
fabpot force-pushed the component-attribute-escaper branch from eef2738 to 13755d9 Compare May 19, 2025 11:23
@fabpot

fabpot commented May 19, 2025

Copy link
Copy Markdown
Member

Thank you @smnandre.

@fabpot
fabpot merged commit c2f7738 into symfony:2.x May 19, 2025
@norkunas

Copy link
Copy Markdown
Contributor

Is it expected that data-action="keydown->tree-view#handleKeydown" is now rendered as data-action="keydown->tree-view#handleKeydown" ? many of our tests are affected :)

@Kocal

Kocal commented May 20, 2025

Copy link
Copy Markdown
Member

@norkunas may be fixed by #2757, but we don't know how you create the ComponentAttributes instance, feel free to open a new issue if needed :)

@norkunas

Copy link
Copy Markdown
Contributor

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LiveComponent Status: Reviewed Has been reviewed by a maintainer TwigComponent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants