Describe the bug
Using laravel folio page routes with embedded livewire volt in it causing livewire to throw exception of corrupt component payload on interaction with livewire props / method
I suspect this happened because blaze see the inline anonymous volt component (automatically named as volt-anonymous-fragment-*) to be a regular anonymous component and automatically optimize it, thus making livewire sees the mismatch and throw the corrupt component payload exception.
-Been tried to set Blaze to only do the optimization to the specific directory and/or exclude path for Folio's page also not helps.
-Wrapping the volt directive, or the whole folio page, with @unblaze/@endunblaze causing the volt/folio page not being rendered any at all.
-Workaround attempt to add middleware in folio pages to disable blaze manually also not work, since it came too late that the folio page already been optimized before the middleware run.
Only workaround is to completely disable blaze at app level (config / env). Once it is disabled, all works fine as it is supposed to.
My question is there any way to skip the compilation for volt-anonymous-fragment-* component, or to exclude that for being optimized by blaze ?
Component causing the issue
{{-- pages/test.blade.php --}}
@props(['title' => 'Test'])
<?php
use Illuminate\Http\Request;
use Illuminate\View\View;
use Livewire\Attributes\On;
use Livewire\Volt\Component;
use function Laravel\Folio\middleware;
use function Laravel\Folio\name;
use function Laravel\Folio\render;
// Volt
new class extends Component
{
public $count = 0;
#[On('increment')]
public function increment(): void
{
$this->count++;
}
#[On('decrement')]
public function decrement(): void
{
if ($this->count <= 0) {
return;
}
$this->count--;
}
};
// Folio
render(function (Request $request, View $view): View {
$message = __('Hello from Folio');
return $view->with(compact('message'));
});
name('test');
middleware([]);
?>
<x-layouts::root :$title>
<div x-data="testData">
@volt('test')
<div>
<div class="flex items-center gap-2">
<button x-on:click.prevent="$wire.decrement">-</button>
<h1>{{ $count }}</h1>
<button x-on:click.prevent="$wire.increment">+</button>
</div>
</div>
@endvolt
<div>
<template x-if="message">
<div>Hello, <span x-text="message"></span></div>
</template>
<button x-on:click.prevent="callByAxios()" x-bind:disabled="processingAxios">Call Api using
Axios</button>
<button x-on:click.prevent="callByFetch()" x-bind:disabled="processingFetch">Call Api
using
Fetch</button>
</div>
<div>{{ $message }}</div>
@push('scripts')
<!-- Test Page -->
<script defer type="text/javascript">
document.addEventListener("alpine:init", () => {
Alpine.data("testData", () => ({
message: '',
processingAxios: false,
processingFetch: false,
async callByAxios() {
this.processingAxios = true;
const response = await api.get('api/test');
setTimeout(() => {
this.processingAxios = false;
this.message = response?.data.message + '(Axios)';
}, 2000);
},
async callByFetch() {
this.processingFetch = true;
const response = await $fetch.get('/api/test');
setTimeout(() => {
this.processingFetch = false;
this.message = response?.message + '(Fetch)';
}, 2000);
}
}))
});
</script>
@endpush
</div>
</x-layouts::root>
Expected behavior
Clicking - or + button works by calling correct volt's method
Actual behavior
Livewire throws exception of
Livewire\Mechanisms\HandleComponents\CorruptComponentPayloadException
vendor/livewire/livewire/src/Mechanisms/HandleComponents/Checksum.php:30
Livewire encountered corrupt data when trying to hydrate a component. Ensure that the [name, id, data] of the Livewire component wasn't tampered with between requests.
Environment
- Laravel version: 13.17.0
- PHP version: 8.5.5
- Blaze version: 1.0.12
- Livewire version : 4.3.3
- Volt version : 1.10.5
Additional context
Completely disable blaze at app level (config / env) fixes the issue.
Describe the bug
Using laravel folio page routes with embedded livewire volt in it causing livewire to throw exception of corrupt component payload on interaction with livewire props / method
I suspect this happened because blaze see the inline anonymous volt component (automatically named as volt-anonymous-fragment-*) to be a regular anonymous component and automatically optimize it, thus making livewire sees the mismatch and throw the corrupt component payload exception.
-Been tried to set Blaze to only do the optimization to the specific directory and/or exclude path for Folio's page also not helps.
-Wrapping the volt directive, or the whole folio page, with @unblaze/@endunblaze causing the volt/folio page not being rendered any at all.
-Workaround attempt to add middleware in folio pages to disable blaze manually also not work, since it came too late that the folio page already been optimized before the middleware run.
Only workaround is to completely disable blaze at app level (config / env). Once it is disabled, all works fine as it is supposed to.
My question is there any way to skip the compilation for volt-anonymous-fragment-* component, or to exclude that for being optimized by blaze ?
Component causing the issue
Expected behavior
Clicking - or + button works by calling correct volt's method
Actual behavior
Livewire throws exception of
Environment
Additional context
Completely disable blaze at app level (config / env) fixes the issue.