-
Notifications
You must be signed in to change notification settings - Fork 47.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e07235b
commit fe37736
Showing
2 changed files
with
76 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/react-devtools-shared/src/backend/shared/DevToolsServerComponentLogs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
// This keeps track of Server Component logs which may come from. | ||
// This is in a shared module because Server Component logs don't come from a specific renderer | ||
// but can become associated with a Virtual Instance of any renderer. | ||
|
||
import type {ReactComponentInfo} from 'shared/ReactTypes'; | ||
|
||
type ComponentLogs = { | ||
errors: Map<string, number>, | ||
errorsCount: number, | ||
warnings: Map<string, number>, | ||
warningsCount: number, | ||
}; | ||
|
||
// This keeps it around as long as the ComponentInfo is alive which | ||
// lets the Fiber get reparented/remounted and still observe the previous errors/warnings. | ||
// Unless we explicitly clear the logs from a Fiber. | ||
export const componentInfoToComponentLogsMap: WeakMap< | ||
ReactComponentInfo, | ||
ComponentLogs, | ||
> = new WeakMap(); |