File tree Expand file tree Collapse file tree 1 file changed +3
-17
lines changed
packages/payload/src/utilities Expand file tree Collapse file tree 1 file changed +3
-17
lines changed Original file line number Diff line number Diff line change @@ -5,31 +5,17 @@ const clientRefSymbol = Symbol.for('react.client.reference')
5
5
export function isReactServerComponentOrFunction < T extends any > (
6
6
component : any | React . ComponentType ,
7
7
) : component is T {
8
- if ( component === null || component === undefined ) {
9
- return false
10
- }
11
- const hasClientComponentSymbol = component . $$typeof == clientRefSymbol
12
-
13
- const isFunctionalComponent = typeof component === 'function'
14
- // Anonymous functions are Client Components in Turbopack. RSCs should have a name
15
- const isAnonymousFunction = typeof component === 'function' && component . name === ''
16
-
17
- const isRSC = isFunctionalComponent && ! isAnonymousFunction && ! hasClientComponentSymbol
18
-
19
- return isRSC
8
+ return typeof component === 'function' && component . $$typeof !== clientRefSymbol
20
9
}
21
10
22
11
export function isReactClientComponent < T extends any > (
23
12
component : any | React . ComponentType ,
24
13
) : component is T {
25
- if ( component === null || component === undefined ) {
26
- return false
27
- }
28
- return ! isReactServerComponentOrFunction ( component ) && component . $$typeof == clientRefSymbol
14
+ return typeof component === 'function' && component . $$typeof === clientRefSymbol
29
15
}
30
16
31
17
export function isReactComponentOrFunction < T extends any > (
32
18
component : any | React . ComponentType ,
33
19
) : component is T {
34
- return isReactServerComponentOrFunction ( component ) || isReactClientComponent ( component )
20
+ return typeof component === 'function'
35
21
}
You can’t perform that action at this time.
0 commit comments