File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
packages/react-relay/relay-hooks Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ import type {UseRefetchableFragmentType} from './legacy/useRefetchableFragment';
16
16
import typeof useFragment from './useFragment' ;
17
17
import type { UsePaginationFragmentType } from './usePaginationFragment' ;
18
18
19
+ import warning from 'warning' ;
20
+
19
21
type HooksImplementation = {
20
22
useFragment : useFragment ,
21
23
usePaginationFragment : UsePaginationFragmentType ,
@@ -24,12 +26,21 @@ type HooksImplementation = {
24
26
} ;
25
27
26
28
let implementation : HooksImplementation | null = null ;
29
+ let alreadyRequested = false ;
27
30
28
31
function inject ( impl : HooksImplementation ) : void {
32
+ if ( alreadyRequested ) {
33
+ warning (
34
+ false ,
35
+ 'HooksImplementation were requested before they were injected.' ,
36
+ ) ;
37
+ return ;
38
+ }
29
39
implementation = impl ;
30
40
}
31
41
32
42
function get ( ) : HooksImplementation | null {
43
+ alreadyRequested = true ;
33
44
return implementation ;
34
45
}
35
46
You can’t perform that action at this time.
0 commit comments