You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Owner Stack is different from the Component Stack available in React error handlers like [`errorInfo.componentStack` in `onUncaughtError`](/reference/react-dom/client/hydrateRoot#show-a-dialog-for-uncaught-errors).
Neither `App`nor the DOM components (e.g. `fieldset`) are considered Owners in this Stack since they didn't contribute to "creating" the node containing `SubComponent`. `App` and DOM components only forwarded the node. `App` just rendered the `children` node as opposed to `Component` which created a node containing `SubComponent` via `<SubComponent />`.
@@ -205,7 +205,7 @@ console.error = function patchedConsoleError(...args) {
205
205
};
206
206
```
207
207
208
-
If you intercept <CodeStepstep={1}>`console.error`</CodeStep> calls to highlight them in an error overlay, you can call <CodeStepstep={2}>`captureOwnerStack`</CodeStep> to include the Owner Stack.
The call of `captureOwnerStack`happened outside of a React controlled function e.g. in a `setTimeout`callback, after a `fetch`call or in a custom DOM event handler. During render, Effects, React event handlers, and React error handlers (e.g. `hydrateRoot#options.onCaughtError`) Owner Stacks should be available.
392
+
`captureOwnerStack`の呼び出しが React 管理外の関数(`setTimeout`のコールバック、`fetch`の後、カスタム DOM イベントハンドラなど)で行われています。レンダー中、エフェクト内、React 管理のイベントハンドラやエラーハンドラ(例:`hydrateRoot#options.onCaughtError`)内では、オーナスタックが利用できるはずです。
393
393
394
-
In the example below, clicking the button will log an empty Owner Stack because `captureOwnerStack`was called during a custom DOM event handler. The Owner Stack must be captured earlier e.g. by moving the call of `captureOwnerStack` into the Effect body.
394
+
以下の例では、`captureOwnerStack`の呼び出しがカスタム DOM イベントハンドラ内で行われているため、ボタンをクリックしてもログに出力されるオーナスタックは空になります。オーナスタックの取得は、呼び出しをエフェクト本体に移動するなどして先に取得しておく必要があります。
395
395
<Sandpack>
396
396
397
397
```js
@@ -435,9 +435,9 @@ export default function App() {
435
435
436
436
</Sandpack>
437
437
438
-
### `captureOwnerStack`is not available {/*captureownerstack-is-not-available*/}
`captureOwnerStack`is only exported in development builds. It will be `undefined`in production builds. If `captureOwnerStack`is used in files that are bundled for production and development, you should conditionally access it from a namespace import.
0 commit comments