Using the word new somewhere (String, variable part, a.s.o) inside a Volt component can cause render problems.
还没有人认领这个 Issue。
评估
调研方向
首先检查负责注入返回视图函数的 Volt 渲染器,然后使用此报告中的三个组件代码片段重现该问题。跟踪规则、渲染文本和变量名中的单词 "new" 如何改变生成的 PHP;当这些示例能够在没有格式错误的 PHP 或异常的情况下完成渲染时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Volt Version
1.10.5
Laravel Version
4.3.3
PHP Version
8.2
Database Driver & Version
No response
Description
As soon as the word "new" appears in certain places of the volt component, the rendering gets weird.
I show 3 examples, but I had even more issues. I guess they all point to the same problem.
I upgraded from Livewire 3 to 4 and I do have numerous Volt components in my project. Quite a few are affected by this bug.
Steps To Reproduce
1. Example
rules([
'count' => ['required', 'int', 'min:1', 'max:1000', new \App\Rules\GhpRule],
'gift' => ['boolean'],
]);
becomes by the volt renderer
rules([
'count' => ['required', 'int', 'min:1', 'max:1000', return new \App\Rules\GhpRule],
'gift' => ['boolean'],
]);
Which gives an exception.
2. Example
THIS DOES cause a render problem:
<?php
use function Livewire\Volt\{state,on,computed};
state([
'new_count' => false,
]);
?>
<div x-data>
<x-svg-icon title="{{ 'Previous new contribution' }}" class="{{ $new_count ? '' : 'opacity-30' }}" icon="up"/>
</div>
THIS DOES NOT cause the render problem:
<?php
use function Livewire\Volt\{state,on,computed};
state([
'new_count' => false,
]);
?>
<div x-data>
<x-svg-icon title="{{ 'Previous contribution' }}" class="{{ $new_count ? '' : 'opacity-30' }}" icon="up"/>
</div>
All that I had to change was to change Previous new contribution to Previous contribution !
The render problem is that the return view function is injected inside the last php function found in the volt component. Which causes an exception at the protected keyword.
3. Example
$new = computed(fn() => $this->forumThread);
becomes by the volt renderer
return new = computed(fn() => $this->forumThread);
Which then throws an exception or course.
When I change this to:
$newThread = computed(fn() => $this->forumThread);
everything works.
- 主要语言
- PHP
- 星标
- 422
- 派生
- 35
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
livewire/volt 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 72/100
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 5/5 一周以上 新手友好度 38/100
-
难度 4/5 3-5 天 新手友好度 35/100
相似的 Issue
-
needs triage
难度 2/5 1-3 小时 新手友好度 72/100
-
loginWithCustomTokenExchange() fails when an organization is configured可能已有人在做 @awss1i 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 2 天内回复
-
type/bug
难度 1/5 1 小时以内 新手友好度 75/100
flarum/framework#5231 · 1 条评论 ·
维护者通常 1 天内回复
-
major-release
难度 1/5 1 小时以内 新手友好度 67/100
Intervention/image#1553 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
omegaup/omegaup#10353 · 1 条评论 ·
维护者通常 5 天内回复