@@ -27,6 +27,8 @@ export class Proxifier {
2727 }
2828
2929 ensureMutationTrackingIsEnabled ( path ) {
30+ if ( process . env . NODE_ENV === 'production' ) return
31+
3032 if ( this . tree . master . options . devmode && ! this . tree . canMutate ( ) ) {
3133 throw new Error (
3234 `proxy-state-tree - You are mutating the path "${ path } ", but it is not allowed. The following could have happened:
@@ -43,6 +45,8 @@ export class Proxifier {
4345 }
4446
4547 ensureValueDosntExistInStateTreeElsewhere ( value ) {
48+ if ( process . env . NODE_ENV === 'production' ) return
49+
4650 if ( value && value [ IS_PROXY ] === true ) {
4751 throw new Error (
4852 `proxy-state-tree - You are trying to insert a value that already exists in the state tree on path "${
@@ -130,7 +134,7 @@ export class Proxifier {
130134 const method = String ( prop )
131135
132136 if ( arrayMutations . has ( method ) ) {
133- proxifier . ensureMutationTrackingIsEnabled ( nestedPath )
137+ /* @__PURE__ */ proxifier . ensureMutationTrackingIsEnabled ( nestedPath )
134138 return ( ...args ) => {
135139 const mutationTree = proxifier . getMutationTree ( )
136140
@@ -141,11 +145,17 @@ export class Proxifier {
141145 hasChangedValue : true ,
142146 } )
143147
144- return target [ prop ] (
145- ...args . map ( ( arg ) =>
146- proxifier . ensureValueDosntExistInStateTreeElsewhere ( arg )
148+ if ( process . env . NODE_ENV === 'production' ) {
149+ return target [ prop ] ( ...args )
150+ } else {
151+ return target [ prop ] (
152+ ...args . map ( ( arg ) =>
153+ /* @__PURE__ */ proxifier . ensureValueDosntExistInStateTreeElsewhere (
154+ arg
155+ )
156+ )
147157 )
148- )
158+ }
149159 }
150160 }
151161
@@ -158,8 +168,10 @@ export class Proxifier {
158168 set ( target , prop , value ) {
159169 const nestedPath = proxifier . concat ( path , prop )
160170
161- proxifier . ensureMutationTrackingIsEnabled ( nestedPath )
162- proxifier . ensureValueDosntExistInStateTreeElsewhere ( value )
171+ /* @__PURE__ */ proxifier . ensureMutationTrackingIsEnabled ( nestedPath )
172+ /* @__PURE__ */ proxifier . ensureValueDosntExistInStateTreeElsewhere (
173+ value
174+ )
163175
164176 const mutationTree = proxifier . getMutationTree ( )
165177
@@ -243,8 +255,10 @@ export class Proxifier {
243255 set ( target , prop , value ) {
244256 const nestedPath = proxifier . concat ( path , prop )
245257
246- proxifier . ensureMutationTrackingIsEnabled ( nestedPath )
247- proxifier . ensureValueDosntExistInStateTreeElsewhere ( value )
258+ /* @__PURE__ */ proxifier . ensureMutationTrackingIsEnabled ( nestedPath )
259+ /* @__PURE__ */ proxifier . ensureValueDosntExistInStateTreeElsewhere (
260+ value
261+ )
248262
249263 let objectChangePath
250264
@@ -273,7 +287,7 @@ export class Proxifier {
273287 deleteProperty ( target , prop ) {
274288 const nestedPath = proxifier . concat ( path , prop )
275289
276- proxifier . ensureMutationTrackingIsEnabled ( nestedPath )
290+ /* @__PURE__ */ proxifier . ensureMutationTrackingIsEnabled ( nestedPath )
277291
278292 let objectChangePath
279293 if ( prop in target ) {
0 commit comments