File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
packages/react-debug-tools/src Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -152,20 +152,21 @@ function nextHook(): null | Hook {
152152function readContext < T > (context: ReactContext< T > ): T {
153153 if ( currentFiber === null ) {
154154 // Hook inspection without access to the Fiber tree
155- // e.g. when filling the primitive stack cache or during `ReactDebugTools.inspectHooks()`.
155+ // e.g. when warming up the primitive stack cache or during `ReactDebugTools.inspectHooks()`.
156156 return context . _currentValue ;
157- }
158- if (currentContextDependency === null) {
159- throw new Error (
160- 'Context reads do not line up with context dependencies. This is a bug in React.' ,
161- ) ;
162- }
157+ } else {
158+ if ( currentContextDependency === null ) {
159+ throw new Error (
160+ 'Context reads do not line up with context dependencies. This is a bug in React.' ,
161+ ) ;
162+ }
163163
164- // For now we don't expose readContext usage in the hooks debugging info.
165- const value = ((currentContextDependency.memoizedValue: any): T);
166- currentContextDependency = currentContextDependency.next;
164+ // For now we don't expose readContext usage in the hooks debugging info.
165+ const value = ((currentContextDependency.memoizedValue: any): T);
166+ currentContextDependency = currentContextDependency.next;
167167
168- return value;
168+ return value;
169+ }
169170}
170171
171172const SuspenseException: mixed = new Error (
You can’t perform that action at this time.
0 commit comments