LoginSignup
2
3

More than 5 years have passed since last update.

Riot3.0にアップデートした時にRiot template errorが出てハマった

Posted at

Riot template error thrown in the <...> tag

タグ内で自身のデータにアクセスしようとした時に下記エラーが出るようになりました。

> Riot template error thrown in the <...> tag

キャプチャ
スクリーンショット 2016-12-12 18.10.48.png

ソースではカスタムタグ内でdata.hogeのようにオブジェクトのプロパティにアクセスしようとしていました。

<custom-tag>
  <h1>This is Riot 3.0</h1>
  <p>Show console, you check error <span style="color:red;">"Riot template error thrown in the <...> tag".<span></p>
  <p>{data.hoge}</p>
</custom-tag>

2.0ではエラーが出ない
サンプル(codepen)

3.0ではエラーが出る
サンプル(codepen)

No update and updated events triggered before the mountが関係しているのかな…

色々試行錯誤していくと、mountされる前にちゃんとupdateでデータを入れてやるとエラーは解消されました。

移行ガイドには、

No update and updated events triggered before the mount

と記載されているので、おそらくmountイベントの前にはupdateが走らないようになったのが関係しているのかなと。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3