Skip to content

Commit c4c79cf

Browse files
committed
refactor(fiber): Update getFiberDEV function logic
1 parent ecb4041 commit c4c79cf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/fiber.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ export const registerDevtoolsHook = ({
145145
const REACT_MAJOR_VERSION = Number(React.version.split('.')[0]);
146146
const dispatcherRefs = new Set();
147147

148+
export const getFiberDEV = (): Fiber | null => {
149+
return (
150+
ReactSharedInternals?.A?.getOwner() ??
151+
ReactSharedInternals?.ReactCurrentOwner?.current
152+
);
153+
};
154+
148155
export const controlDispatcherRef = (currentDispatcherRef: any) => {
149156
const ref = currentDispatcherRef;
150157
if (ref && !dispatcherRefs.has(ref)) {

0 commit comments

Comments
 (0)