2017-12-01 01:57:13 +08:00
|
|
|
/**
|
2022-10-18 23:19:24 +08:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2017-12-01 01:57:13 +08:00
|
|
|
*
|
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
|
*
|
|
|
|
|
* @flow
|
|
|
|
|
*/
|
|
|
|
|
|
Split cross-package types from implementation
Some of our internal reconciler types have leaked into other packages.
Usually, these types are treated as opaque; we don't read and write
to its fields. This is good.
However, the type is often passed back to a reconciler method. For
example, React DOM creates a FiberRoot with `createContainer`, then
passes that root to `updateContainer`. It doesn't do anything with the
root except pass it through, but because `updateContainer` expects a
full FiberRoot, React DOM is still coupled to all its fields.
I don't know if there's an idiomatic way to handle this in Flow. Opaque
types are simlar, but those only work within a single file. AFAIK,
there's no way to use a package as the boundary for opaqueness.
The immediate problem this presents is that the reconciler refactor will
involve changes to our internal data structures. I don't want to have to
fork every single package that happens to pass through a Fiber or
FiberRoot, or access any one of its fields. So my current plan is to
share the same Flow type across both forks. The shared type will be a
superset of each implementation's type, e.g. Fiber will have both an
`expirationTime` field and a `lanes` field. The implementations will
diverge, but not the types.
To do this, I lifted the type definitions into a separate module.
2020-04-09 14:48:24 +08:00
|
|
|
import type {Fiber} from './ReactInternalTypes';
|
2020-04-04 10:01:40 +08:00
|
|
|
import type {CapturedValue} from './ReactCapturedValue';
|
2017-12-01 01:57:13 +08:00
|
|
|
|
|
|
|
|
// This module is forked in different environments.
|
|
|
|
|
// By default, return `true` to log errors to the console.
|
|
|
|
|
// Forks can return `false` if this isn't desirable.
|
2020-04-04 10:01:40 +08:00
|
|
|
|
|
|
|
|
export function showErrorDialog(
|
|
|
|
|
boundary: Fiber,
|
|
|
|
|
errorInfo: CapturedValue<mixed>,
|
|
|
|
|
): boolean {
|
2017-12-01 01:57:13 +08:00
|
|
|
return true;
|
|
|
|
|
}
|