yesoreyeram / yesoreyeram-boomtheme-panel

Grafana Panel for adding styles
http://yesoreyeram.github.io/yesoreyeram-boomtheme-panel
Apache License 2.0
88 stars 14 forks source link

Fix: Do not map empty theme array #46

Closed koszti closed 2 years ago

koszti commented 2 years ago

Problem

The new react version of this plugin (v0.2.0-alpha.6) fails at the first time when using it on a new dashboard.

Fix

The problem occures when it's trying to map the themes array before it's been defined. The fix is using the ?. operator to avoid errors caused by nulls.

To reproduce

Install the plugin, try to use it on a new dashboard to make sure there is no exsting themes. When selecting Boom Theme from the visualisation dropdown grafana shows an error:

An unexpected error happened
TypeError: t is undefined

J@http://localhost:3000/public/plugins/yesoreyeram-boomtheme-panel/module.js:2:30926
editor@http://localhost:3000/public/plugins/yesoreyeram-boomtheme-panel/module.js:2:31692
div
div
p@http://localhost:3000/public/build/8966.9293a56f182a84c40c07.js:410:168
div