Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/BlazeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Livewire\Blaze;

use Illuminate\Support\Facades\Event;
use Illuminate\View\Engines\CompilerEngine;
use Livewire\Blaze\Compiler\Wrapper;
use Livewire\Blaze\Compiler\Compiler;
use Livewire\Blaze\Directive\BlazeDirective;
Expand Down Expand Up @@ -193,13 +194,19 @@ public function collectAndAppendFrontMatter($template, $callback)
*/
public function viewContainsExpiredFrontMatter($view): bool
{
$engine = $view->getEngine();

if (! $engine instanceof CompilerEngine) {
return false;
}

$path = $view->getPath();

if (isset($this->expiredMemo[$path])) {
return $this->expiredMemo[$path];
}

$compiler = $view->getEngine()->getCompiler();
$compiler = $engine->getCompiler();
$compiled = $compiler->getCompiledPath($path);
$expired = $compiler->isExpired($path);

Expand Down
9 changes: 8 additions & 1 deletion tests/BlazeTest.php → tests/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@
$input = '{{-- <x-input /> --}}';

expect(Blade::render($input))->toBe('');
});
});

// TODO: Install PHPStan, which probably would have caught this.
test('supports php engine', function () {
// Make sure our hooks do not break views
// rendered using the regular php engine.
view('php-view')->render();
})->throwsNoExceptions();
1 change: 1 addition & 0 deletions tests/fixtures/views/php-view.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<input type="text" disabled />