Skip to content

Commit

Permalink
Make a shallow copy of blocks instead of deep copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Tug committed Nov 14, 2018
1 parent 34bc0b9 commit 0c614ea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/block-management/block-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import React from 'react';
import { cloneDeep, isEqual } from 'lodash';
import { isEqual } from 'lodash';

import { Platform, Switch, Text, View, FlatList, KeyboardAvoidingView } from 'react-native';
import RecyclerViewList, { DataSource } from 'react-native-recyclerview-list';
Expand Down Expand Up @@ -52,7 +52,7 @@ export default class BlockManager extends React.Component<PropsType, StateType>
super( props );

const blocks = props.blocks.map( ( block ) => {
const newBlock = cloneDeep( block );
const newBlock = { ...block };
newBlock.focused = props.isBlockSelected( block.clientId );
return newBlock;
} );
Expand Down Expand Up @@ -132,7 +132,7 @@ export default class BlockManager extends React.Component<PropsType, StateType>
}

const blocks = props.blocks.map( ( block ) => {
const newBlock = cloneDeep( block );
const newBlock = { ...block };
newBlock.focused = props.isBlockSelected( block.clientId );
return newBlock;
} );
Expand Down

0 comments on commit 0c614ea

Please sign in to comment.