Using the word new somewhere (String, variable part, a.s.o) inside a Volt component can cause render problems.
まだ誰も着手していません。
評価
調査の方向性
まず、return view function の注入を担当する Volt renderer を調査し、次にこのレポートにある 3 つのコンポーネントスニペットで問題を再現してください。ルール、レンダリングされたテキスト、変数名に含まれる単語 "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 ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
livewire/volt のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
MISP/misp-docker#478 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
glpi-project/glpi#26045 ·
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
-
Перевод устарел
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100