Skip to content

Commit

Permalink
fix: remove Object.assign, fixes #1226
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Apr 10, 2019
1 parent 4ec5d68 commit c5af009
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/adapters/preact.js
@@ -1,4 +1,4 @@
import configuration from '../configuration'
import { setConfiguration } from '../configuration'

const tune = {
allowSFC: false,
Expand All @@ -7,7 +7,7 @@ const tune = {
export const preactAdapter = (instance, resolveType) => {
const oldHandler = instance.options.vnode

Object.assign(configuration, tune)
setConfiguration(tune)

instance.options.vnode = vnode => {
vnode.nodeName = resolveType(vnode.nodeName)
Expand Down
9 changes: 9 additions & 0 deletions src/configuration.js
Expand Up @@ -44,4 +44,13 @@ export const internalConfiguration = {
disableProxyCreation: false,
}

export const setConfiguration = config => {
// not using Object.assing for IE11 compliance
for (const i in config) {
if (config.hasOwnProperty(i)) {
configuration[i] = config[i]
}
}
}

export default configuration
8 changes: 4 additions & 4 deletions src/internal/getReactStack.js
Expand Up @@ -36,10 +36,10 @@ const markUpdate = ({ fiber }) => {
}

if (fiber.memoizedProps && typeof fiber.memoizedProps === 'object') {
fiber.memoizedProps = Object.assign(
{ cacheBusterProp: true },
fiber.memoizedProps,
)
fiber.memoizedProps = {
cacheBusterProp: true,
...fiber.memoizedProps,
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/utils.dev.js
Expand Up @@ -3,7 +3,7 @@ import {
getProxyByType,
setComponentOptions,
} from './reconciler/proxies'
import configuration from './configuration'
import { setConfiguration } from './configuration'
import { hotComponentCompare } from './reconciler/componentComparator'

const getProxyOrType = type => {
Expand All @@ -25,4 +25,4 @@ export const cold = type => {
export const configureComponent = (component, options) =>
setComponentOptions(component, options)

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

0 comments on commit c5af009

Please sign in to comment.