Skip to content

Commit

Permalink
fix(applyProps): loosen copy identity in dev (#3025)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett authored Oct 6, 2023
1 parent 3b5e749 commit 8ac02d2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/fiber/src/core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ export function diffProps(
return { memoized, changes }
}

const __DEV__ = typeof process !== 'undefined' && process.env.NODE_ENV !== 'production'

// This function applies a set of changes to the instance
export function applyProps(instance: Instance, data: InstanceProps | DiffSet) {
// Filter equals, events and reserved props
Expand Down Expand Up @@ -361,7 +363,13 @@ export function applyProps(instance: Instance, data: InstanceProps | DiffSet) {
targetProp.copy &&
value &&
(value as ClassConstructor).constructor &&
targetProp.constructor === (value as ClassConstructor).constructor
// Some environments may break strict identity checks by duplicating versions of three.js.
// Loosen to unminified names, ignoring descendents.
// https://github.com/pmndrs/react-three-fiber/issues/2856
// TODO: fix upstream and remove in v9
(__DEV__
? targetProp.constructor.name === (value as ClassConstructor).constructor.name
: targetProp.constructor === (value as ClassConstructor).constructor)
) {
targetProp.copy(value)
}
Expand Down

0 comments on commit 8ac02d2

Please sign in to comment.