Skip to content

fix[rdt/fiber/renderer.js]: getCurrentFiber can be injected as null #30968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/react-devtools-shared/src/backend/fiber/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ export function attach(
function getComponentStack(
topFrame: Error,
): null | {enableOwnerStacks: boolean, componentStack: string} {
if (getCurrentFiber === undefined) {
if (getCurrentFiber == null) {
// Expected this to be part of the renderer. Ignore.
return null;
}
Expand Down Expand Up @@ -1130,7 +1130,7 @@ export function attach(
type: 'error' | 'warn',
args: $ReadOnlyArray<any>,
): void {
if (getCurrentFiber === undefined) {
if (getCurrentFiber == null) {
// Expected this to be part of the renderer. Ignore.
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-devtools-shared/src/backend/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export type ReactRenderer = {
currentDispatcherRef?: LegacyDispatcherRef | CurrentDispatcherRef,
// Only injected by React v16.9+ in DEV mode.
// Enables DevTools to append owners-only component stack to error messages.
getCurrentFiber?: () => Fiber | null,
getCurrentFiber?: (() => Fiber | null) | null,
// Only injected by React Flight Clients in DEV mode.
// Enables DevTools to append owners-only component stack to error messages from Server Components.
getCurrentComponentInfo?: () => ReactComponentInfo | null,
Expand Down
Loading