Skip to content

Fix/inspector in magewire templates#168

Merged
dermatz merged 6 commits intomainfrom
fix/inspector-in-magewire-templates
Apr 13, 2026
Merged

Fix/inspector in magewire templates#168
dermatz merged 6 commits intomainfrom
fix/inspector-in-magewire-templates

Conversation

@dermatz
Copy link
Copy Markdown
Member

@dermatz dermatz commented Apr 13, 2026

This pull request improves compatibility between the Inspector and Magewire components by introducing several exclusion mechanisms to prevent rendering errors. The changes ensure that blocks and templates related to Magewire are automatically skipped by the Inspector, avoiding issues with wire attribute injection.

Inspector exclusion mechanisms for Magewire compatibility

  • Added constructor parameters excludedClassPrefixes and excludedTemplatePaths to InspectorHints to allow specifying block class prefixes and template path substrings that should be excluded from Inspector wrapping.
  • Implemented methods isExcluded, isExcludedTemplate, and containsWireAttributes in InspectorHints to check if a block class, template path, or rendered HTML should be excluded from Inspector wrapping.
  • Updated the render method in InspectorHints to skip Inspector wrapping for:
    • Excluded block classes and template paths,
    • Blocks with Magewire data,
    • Rendered HTML containing wire attributes (wire:id, wire:initial-data).
  • Registered `Magewirephp\MagewireThis pull request improves compatibility between the Inspector and Magewire components by introducing several exclusion mechanisms to prevent rendering errors. The changes ensure that blocks and templates related to Magewire are automatically skipped by the Inspector, avoiding issues with wire attribute injection.

Inspector exclusion mechanisms for Magewire compatibility

  • Added constructor parameters excludedClassPrefixes and excludedTemplatePaths to InspectorHints to allow specifying block class prefixes and template path substrings that should be excluded from Inspector wrapping.
  • Implemented methods isExcluded, isExcludedTemplate, and containsWireAttributes in InspectorHints to check if a block class, template path, or rendered HTML should be excluded from Inspector wrapping.
  • Updated the render method in InspectorHints to skip Inspector wrapping for:
    • Excluded block classes and template paths,
    • Blocks with Magewire data,
    • Rendered HTML containing wire attributes (wire:id, wire:initial-data).
      as an excluded block class prefix and magewire/ as an excluded template path in the DI configuration (di.xml).

Documentation

  • Added a note to the README.md explaining that the Inspector is not compatible with Magewire components and that Magewire blocks are automatically excluded from inspection.

@dermatz dermatz marked this pull request as ready for review April 13, 2026 06:26
Copilot AI review requested due to automatic review settings April 13, 2026 06:26
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Apr 13, 2026
Copy link
Copy Markdown
Contributor

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

Improves MageForge Inspector’s compatibility with Magewire-rendered blocks/templates by introducing configurable exclusion checks to avoid wrapping output that would break Magewire’s post-render wire:* attribute injection.

Changes:

  • Added configurable exclusion lists (block class prefixes + template path substrings) to InspectorHints.
  • Updated Inspector wrapping logic to skip excluded blocks/templates and to bypass wrapping when Magewire indicators are detected (block data key and/or wire:* attributes in rendered HTML).
  • Documented the limitation/behavior in README and wired default Magewire exclusions via frontend DI.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Model/TemplateEngine/Decorator/InspectorHints.php Adds exclusion mechanisms and skip logic to prevent Inspector wrapping from breaking Magewire components.
src/etc/frontend/di.xml Configures default frontend exclusions for Magewire block namespace prefix and template path substring.
README.md Documents Inspector’s Magewire incompatibility and automatic exclusion behavior.

@dermatz dermatz merged commit 9abe851 into main Apr 13, 2026
13 checks passed
@dermatz dermatz deleted the fix/inspector-in-magewire-templates branch April 13, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants