Description
Laravel Version
12.20.0
PHP Version
8.4.10
Database Driver & Version
No response
Description
This issue references this recent change: #56159
Unfortunately this change broke my production quite badly and I had to revert. My use-case is that I regularly provide the front-end Vue components with initial data as props using the JS::from helper within the blade view, example:
@section("content")
<my-component
:initial-data="{{ Js::from($intitialData) }}"
></my-component>
@endsection
Often the data provided is an Illuminate\Pagination\LengthAwarePaginator
which of course is Htmlable
.
I understand the motivation behind this PR, but I feel it should at least be opt-in rather than the default behaviour. Alternatively, perhaps it could only be triggered if the output would be {}
without this?
Steps To Reproduce
- Pass a Illuminate\Pagination\LengthAwarePaginator to a blade view from the controller.
- Attempt to pass this as a prop to vue component using
Js::from
helper as shown above. - Instead of a nicely formed json object being provided as a prop, an html string is provided to the component instead.