infaira-canvas 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/init.js +2 -2
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -174,7 +174,7 @@ export interface IWidgetProps {
|
|
|
174
174
|
const ${componentName}: React.FC<IWidgetProps> = ({ icanContext, instanceId: _instanceId }) => {
|
|
175
175
|
const [data, setData] = React.useState<unknown>(null);
|
|
176
176
|
const [loading, setLoading] = React.useState(true);
|
|
177
|
-
const [error,
|
|
177
|
+
const [error, _setError] = React.useState<string | null>(null);
|
|
178
178
|
|
|
179
179
|
React.useEffect(() => {
|
|
180
180
|
if (!icanContext) {
|
|
@@ -184,7 +184,7 @@ const ${componentName}: React.FC<IWidgetProps> = ({ icanContext, instanceId: _in
|
|
|
184
184
|
// Example: fetch data from Orch
|
|
185
185
|
// icanContext.executeAction('MyModel', 'GetAll', {}, { json: true })
|
|
186
186
|
// .then((result) => { setData(result); setLoading(false); })
|
|
187
|
-
// .catch((err: unknown) => {
|
|
187
|
+
// .catch((err: unknown) => { _setError(String(err)); setLoading(false); });
|
|
188
188
|
setData('Hello from ${widgetName}!');
|
|
189
189
|
setLoading(false);
|
|
190
190
|
}, [icanContext]);
|