laravel-blade-comments icon indicating copy to clipboard operation
laravel-blade-comments copied to clipboard

[Bug]: Blade Comments "AnonymousBladeComponentCommenter" breaks Laravel Pulse

Open xHeaven opened this issue 2 years ago • 3 comments

What happened?

The package breaks Laravel Pulse's interface. See more here: https://github.com/laravel/pulse/issues/91

How to reproduce the bug

Install Laravel Pulse (currently v1.0.0-beta5), then install this package (currently v1.2.2), enable the AnonymousBladeComponentCommenter and visit your.app/pulse.

Package Version

1.2.2

PHP Version

8.3.0

Laravel Version

10.35.0

Which operating systems does with happen with?

macOS, Windows, Linux

Notes

No response

xHeaven avatar Dec 06 '23 00:12 xHeaven

This looks like a hard one one to solve. It seems to be that the anonymous components are used at the root level of the Livewire components, which breaks things. If I edit AnonymousBladeComponentCommenter and wrap the comment in a div the error goes away, but the styling is messed up.

I don't believe there's a way to check if the component is being used in a Livewire component at the stage where we add the comment.

The best solution might be that I extend the exludes functionality and add the Pulse namespace as a default to exclude when adding comments to anonymous components. Not ideal, but at least it would stop breaking Pulse.

timvandijck avatar Dec 21 '23 16:12 timvandijck

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

spatie-bot avatar Apr 22 '24 10:04 spatie-bot

We're also experiencing this issue and cannot figure out how to disable laravel-blade-comments for just Laravel Pulse.

Any tips on how we might go about doing that? The following doesn't do the trick:

	/*
	 * Do not add comments to the output of these directives.
	 */
	'excludes' => [
		'includes' => [
			'vendor.pulse.dashboard', // TODO: Disable for Pulse. This does not seem to work.
		],
	],

johnbacon avatar May 21 '24 22:05 johnbacon

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

spatie-bot avatar Sep 25 '24 10:09 spatie-bot

If I edit AnonymousBladeComponentCommenter and wrap the comment in a div the error goes away, but the styling is messed up.

What if you wrap it in something else, e.g. < template > or < blade-comment ></ blade-comment >?

mxts avatar Apr 03 '25 16:04 mxts