Skip to content

Commit

Permalink
fix(reactivity): add NaN prop on Array should not trigger length depe…
Browse files Browse the repository at this point in the history
…ndency. (#1998)
  • Loading branch information
HeftyKoo authored Sep 15, 2020
1 parent 124c385 commit 0d4910a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/reactivity/__tests__/reactiveArray.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ describe('reactivity/reactive/Array', () => {
expect(fn).toHaveBeenCalledTimes(1)
observed[-1] = 'x'
expect(fn).toHaveBeenCalledTimes(1)
observed[NaN] = 'x'
expect(fn).toHaveBeenCalledTimes(1)
})

describe('Array methods w/ refs', () => {
Expand Down
5 changes: 4 additions & 1 deletion packages/shared/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ export const isPlainObject = (val: unknown): val is object =>
toTypeString(val) === '[object Object]'

export const isIntegerKey = (key: unknown) =>
isString(key) && key[0] !== '-' && '' + parseInt(key, 10) === key
isString(key) &&
key !== 'NaN' &&
key[0] !== '-' &&
'' + parseInt(key, 10) === key

export const isReservedProp = /*#__PURE__*/ makeMap(
'key,ref,' +
Expand Down

0 comments on commit 0d4910a

Please sign in to comment.