Skip to content

Commit 5e8cbbd

Browse files
authored
Merge pull request #8 from HumanSignal/fb-leap-1972/ensure-initial-state
fix: LEAP-1972: Minor improvements
2 parents 75fd2ab + 4d71df7 commit 5e8cbbd

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

custom-scripts/different-images-per-label/script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
const IMG_ID = 'img_uniq'
77
// TODO: use your own keys and values here for label lookup and data objects to display
8-
const imagesRoot = '/static/custom-scripts/custom-scripts/show_different_images_based_on_label_selected/img'
8+
const imagesRoot = '/static/custom-scripts/custom-scripts/different-images-per-label/img'
99
const images = {
1010
'Addressee': `${imagesRoot}/demo-addressee.jpg`,
1111
'Account number': `${imagesRoot}/demo-routing-number.png`,

custom-scripts/different-images-per-label/view.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<!--
2323
{
2424
"data": {
25-
"image": "/static/custom-scripts/custom-scripts/show_different_images_based_on_label_selected/img/demo-sample.png"
25+
"image": "/static/custom-scripts/custom-scripts/different-images-per-label/img/demo-sample.png"
2626
}
2727
}
2828
-->

custom-scripts/plotly/script.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
await LSI.import('https://cdn.plot.ly/plotly-2.26.0.min.js', 'sha384-xuh4dD2xC9BZ4qOrUrLt8psbgevXF2v+K+FrXxV4MlJHnWKgnaKoh74vd/6Ik8uF',);
66

77
let data = LSI.task.data;
8-
if (window.Plotly && data) {
8+
if (!window.Plotly || !data) {
9+
Htx.showModal("Plotly data not found in task", "error");
10+
}
11+
12+
try {
913
Plotly.newPlot("plot", [data.plotly]);
14+
} catch (error) {
15+
Htx.showModal(`Error loading Plotly: ${error.message}`, "error");
1016
}

0 commit comments

Comments
 (0)