Skip to content

Commit

Permalink
Fix updateProps creating new props object (#6280)
Browse files Browse the repository at this point in the history
updateProps deep cloned props thus rendering instance comparisons useless.
closes #6262
  • Loading branch information
jinshin1013 authored Jun 10, 2020
1 parent 91fda4f commit b1a1e0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/src/commands/Commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ export class Commands {
}

public updateProps(componentId: string, props: object) {
const input = cloneDeep(props);
this.store.updateProps(componentId, input);
this.store.updateProps(componentId, props);
this.commandsObserver.notify('updateProps', { componentId, props });
}

Expand Down
6 changes: 4 additions & 2 deletions lib/src/components/ComponentWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';
import { ComponentProvider } from 'react-native';
import merge from 'lodash/merge';
import { polyfill } from 'react-lifecycles-compat';
import hoistNonReactStatics from 'hoist-non-react-statics';

Expand Down Expand Up @@ -28,7 +27,10 @@ export class ComponentWrapper {
class WrappedComponent extends React.Component<HocProps, HocState> {
static getDerivedStateFromProps(nextProps: any, prevState: HocState) {
return {
allProps: merge({}, nextProps, store.getPropsForId(prevState.componentId))
allProps: {
...nextProps,
...store.getPropsForId(prevState.componentId)
}
};
}

Expand Down

0 comments on commit b1a1e0d

Please sign in to comment.