Skip to content

Commit c5af009

Browse files
committed
fix: remove Object.assign, fixes #1226
1 parent 4ec5d68 commit c5af009

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

Diff for: src/adapters/preact.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import configuration from '../configuration'
1+
import { setConfiguration } from '../configuration'
22

33
const tune = {
44
allowSFC: false,
@@ -7,7 +7,7 @@ const tune = {
77
export const preactAdapter = (instance, resolveType) => {
88
const oldHandler = instance.options.vnode
99

10-
Object.assign(configuration, tune)
10+
setConfiguration(tune)
1111

1212
instance.options.vnode = vnode => {
1313
vnode.nodeName = resolveType(vnode.nodeName)

Diff for: src/configuration.js

+9
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,13 @@ export const internalConfiguration = {
4444
disableProxyCreation: false,
4545
}
4646

47+
export const setConfiguration = config => {
48+
// not using Object.assing for IE11 compliance
49+
for (const i in config) {
50+
if (config.hasOwnProperty(i)) {
51+
configuration[i] = config[i]
52+
}
53+
}
54+
}
55+
4756
export default configuration

Diff for: src/internal/getReactStack.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ const markUpdate = ({ fiber }) => {
3636
}
3737

3838
if (fiber.memoizedProps && typeof fiber.memoizedProps === 'object') {
39-
fiber.memoizedProps = Object.assign(
40-
{ cacheBusterProp: true },
41-
fiber.memoizedProps,
42-
)
39+
fiber.memoizedProps = {
40+
cacheBusterProp: true,
41+
...fiber.memoizedProps,
42+
}
4343
}
4444
}
4545

Diff for: src/utils.dev.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
getProxyByType,
44
setComponentOptions,
55
} from './reconciler/proxies'
6-
import configuration from './configuration'
6+
import { setConfiguration } from './configuration'
77
import { hotComponentCompare } from './reconciler/componentComparator'
88

99
const getProxyOrType = type => {
@@ -25,4 +25,4 @@ export const cold = type => {
2525
export const configureComponent = (component, options) =>
2626
setComponentOptions(component, options)
2727

28-
export const setConfig = config => Object.assign(configuration, config)
28+
export const setConfig = config => setConfiguration(config)

0 commit comments

Comments
 (0)