@@ -54,24 +54,32 @@ export interface ProviderProps<
54
54
children : ReactNode
55
55
}
56
56
57
- function Provider < A extends Action < string > = UnknownAction , S = unknown > ( {
58
- store,
59
- context,
60
- children,
61
- serverState,
62
- stabilityCheck = 'once' ,
63
- identityFunctionCheck = 'once' ,
64
- } : ProviderProps < A , S > ) {
57
+ function Provider < A extends Action < string > = UnknownAction , S = unknown > (
58
+ providerProps : ProviderProps < A , S > ,
59
+ ) {
60
+ const { children, context, serverState, store } = providerProps
61
+
65
62
const contextValue = React . useMemo ( ( ) => {
66
63
const subscription = createSubscription ( store )
67
- return {
64
+
65
+ const baseContextValue = {
68
66
store,
69
67
subscription,
70
68
getServerState : serverState ? ( ) => serverState : undefined ,
71
- stabilityCheck,
72
- identityFunctionCheck,
73
69
}
74
- } , [ store , serverState , stabilityCheck , identityFunctionCheck ] )
70
+
71
+ if ( process . env . NODE_ENV === 'production' ) {
72
+ return baseContextValue
73
+ } else {
74
+ const { identityFunctionCheck = 'once' , stabilityCheck = 'once' } =
75
+ providerProps
76
+
77
+ return /* @__PURE__ */ Object . assign ( baseContextValue , {
78
+ stabilityCheck,
79
+ identityFunctionCheck,
80
+ } )
81
+ }
82
+ } , [ store , serverState ] )
75
83
76
84
const previousState = React . useMemo ( ( ) => store . getState ( ) , [ store ] )
77
85
0 commit comments