File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
frameworks/keyed/react-native-onyx/src Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -128,11 +128,13 @@ function select(item) {
128128}
129129function swapRows ( ) {
130130 const array = Object . values ( object ) ;
131- const firstRow = array [ 1 ] ;
132- const lastRow = array [ 998 ] ;
131+ const firstRow = { ... array [ 1 ] } ;
132+ const lastRow = { ... array [ 998 ] } ;
133133
134- Onyx . set ( `${ ONYXKEYS . COLLECTION . OBJECT } ${ firstRow . id === 2 ? firstRow . id : lastRow . id } ` , lastRow ) ;
135- Onyx . set ( `${ ONYXKEYS . COLLECTION . OBJECT } ${ lastRow . id === 999 ? lastRow . id : firstRow . id } ` , firstRow ) ;
134+ Onyx . mergeCollection ( ONYXKEYS . COLLECTION . OBJECT , {
135+ [ `${ ONYXKEYS . COLLECTION . OBJECT } ${ firstRow . id === 2 ? firstRow . id : lastRow . id } ` ] : lastRow ,
136+ [ `${ ONYXKEYS . COLLECTION . OBJECT } ${ lastRow . id === 999 ? lastRow . id : firstRow . id } ` ] : firstRow ,
137+ } ) ;
136138}
137139function clear ( ) {
138140 Onyx . clear ( ) ;
You can’t perform that action at this time.
0 commit comments