Skip to content

Commit

Permalink
fix: remove deepmerge to prevent wrong merges
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Aug 22, 2018
1 parent b0bd6a5 commit 3578ff2
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"dependencies": {
"callbag-observe": "^1.0.0",
"callbag-subject": "^1.0.2",
"deepmerge": "^2.1.1",
"fast-deep-equal": "^2.0.1",
"react": "^16.4.2",
"react-dom": "^16.4.2"
Expand Down
3 changes: 1 addition & 2 deletions src/reworm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { PureComponent } from 'react'
import observe from 'callbag-observe'
import makeSubject from 'callbag-subject'
import equal from 'fast-deep-equal'
import merge from 'deepmerge'

const isPrimitive = (test: any) => test !== Object(test)

Expand Down Expand Up @@ -48,7 +47,7 @@ export function create<T = any>(initial: T = {} as T): State<T> {
private update = (next: T): void => {
const nextState = typeof next === 'function' ? next(this._state) : next
const newState = !isPrimitive(nextState)
? merge(this._state, nextState)
? Object.assign({}, this._state, nextState)
: nextState

const isEqual = !isPrimitive(newState)
Expand Down
1 change: 0 additions & 1 deletion src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
declare module 'deepmerge'
declare module 'fast-deep-equal'
declare module 'callbag-observe'
declare module 'callbag-subject'
4 changes: 0 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1093,10 +1093,6 @@ deep-is@~0.1.3:
version "0.1.3"
resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"

deepmerge@^2.1.1:
version "2.1.1"
resolved "https://registry.npmjs.org/deepmerge/-/deepmerge-2.1.1.tgz#e862b4e45ea0555072bf51e7fd0d9845170ae768"

default-require-extensions@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-2.0.0.tgz#f5f8fbb18a7d6d50b21f641f649ebb522cfe24f7"
Expand Down

0 comments on commit 3578ff2

Please sign in to comment.