Skip to content

Commit 2ac82ef

Browse files
committed
Revert "fix: incorrect flag for diff algorithm"
This reverts commit 45de6bf.
1 parent 9a44e57 commit 2ac82ef

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

src/utils/diff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export function diff<T>(oldList: ReadonlyArray<T>, newList: ReadonlyArray<T>, pk
174174
}
175175
}
176176

177-
const arrayIsSame = reused === curr.length && prev.length === curr.length && reused !== 0
177+
const arrayIsSame = reused === curr.length && prev.length === curr.length
178178
return {
179179
type: arrayIsSame ? OpsType.ShouldSkip : OpsType.Success,
180180
ops: ret,

test/specs/utils/diff.spec.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,13 +328,6 @@ export default describe('Diff Testcase: ', () => {
328328
const result = diff([{ id: 1, a: 1 }], [{ id: 1, a: 1 }], 'id')
329329
expect(result.type).to.equal(2)
330330
})
331-
332-
it('should be able to use old list except reused number is 0: 27', () => {
333-
// when old list is empty & new list is empty
334-
// should not return skip flag
335-
const result = diff([], [], 'id')
336-
expect(result.type).to.equal(1)
337-
})
338331
})
339332

340333
describe('Function: getPatchResult', () => {

0 commit comments

Comments
 (0)