Skip to content

Commit baa871a

Browse files
committed
docs: ✏️ document onError logic
1 parent a7bf45d commit baa871a

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

packages/create-widget/views/preact/template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"@merkur/preact": "0.39.0"
3+
"@merkur/preact": "0.40.0"
44
},
55
"devDependencies": {
66
"@testing-library/jest-dom": "^6.5.0",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"@merkur/svelte": "0.39.0"
3+
"@merkur/svelte": "0.40.0"
44
},
55
"devDependencies": {}
66
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"@merkur/uhtml": "0.39.0"
3+
"@merkur/uhtml": "0.40.0"
44
},
55
"devDependencies": {}
66
}

website/docs/integration-with-app.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,15 +288,20 @@ return (
288288
You can also react to component events through callbacks.
289289
- When widget is mounted, a function passed through `onWidgetMounted` prop is called with the widget instance.
290290
- Before the widget is unmounted, `onWidgetUnmounting` is called.
291-
- Whenever error occurs during the widget lifetime, an `onError` function prop is called.
291+
- Whenever error occurs during the widget lifetime, an `onError` function prop is called. If the `onError` callback returns `true`, the default error fallback will **not** be displayed, allowing you to handle the error with your own custom UI or logic.
292292
293293
```jsx
294294
return (
295295
<MerkurWidget
296296
widgetProperties={widgetProperties}
297297
onWidgetMounted={widget => this._widgetMounted()}
298298
onWidgetUnmouting={widget => this._widgetUnmounting()}
299-
onError={error => this._handleError(error)}>
299+
onError={error => {
300+
console.error('Widget error:', error);
301+
// Return true to prevent showing the default error fallback
302+
// Return false or undefined to show the default error fallback
303+
return this._handleError(error);
304+
}}>
300305
<div>
301306
Fallback for undefined widgetProperties
302307
</div>

0 commit comments

Comments
 (0)