Skip to content

parameter missing in extended array find method #11573

Closed
@edison1105

Description

@edison1105

Vue version

3.5

Link to minimal reproduction

https://play.vuejs.org/#eNqNU8GK2zAQ/ZVBF2fB2JS0FIId2C57aA9taXsUFK81cZTKkpHk7JaQf++zXafesoQFD5Zn3mjmvRmfxG3XZceexUYUofa6ixQ49t1WWt12zkc6keeqjvrIdKaddy0lwCfSSlubKgS6c8YwAM4SP0W2KtCt99VvOklLtNNWrbRKbdVyWjUwpTyHcDOFifKctKV19paMazaUVEmaPMBqmEKZJebdc0xvFeN+VildjlNC7WxwhjPAXy4+wTyoekuh79hnY6fu4UDllvDKtKKyLEmrmwF8lhYPOONmaBSryFRepFmNZOJe2yZsyPLjQpUV8s8wiURkZRNqKvcf2xFV5NMgMIIictsZJOFMVOzfbAPzTK7I8T3519srEgK3fo57hYx/k4p80YFIRQwovtNNdgjOYmdG2lLUru20Yf+lGwgHKTbzdKWojHGPn0Zf9D2ns7/ec/3rBf8hPA0+Kb5iUuyPLMUlFivfcJzC998/Y90Wwdap3gB9JfiNIVw/9DjBPoAv2l7gxm4/jpuPKf0I98NGh5nU0Oi4DCNeCvwId1eo/2sXs5mXCCr+PLIf7oSACGTr9+L8B25yI2Q=

Steps to reproduce

Playground with v3.4
Playground with v3.5

Open playground links and see Console

What is expected?

log a b c d in v3.5

What is actually happening?

log

(item, index) {
        return fn.call(this, toReactive(item), index, self);
      } 'b' undefined undefined

with this PR, it logs

'a' 'b' undefined undefined

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1
    Memory: 131.72 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.16.0 - /usr/local/bin/node
    npm: 10.8.1 - /usr/local/bin/npm
    pnpm: 9.6.0 - /usr/local/bin/pnpm
    bun: 1.0.0 - /usr/local/bin/bun
  Browsers:
    Chrome: 127.0.6533.100
    Safari: 17.5

Any additional comments?

The proxy find method passes only two parameters. see

find(
fn: (item: unknown, index: number, array: unknown[]) => boolean,
thisArg?: unknown,
) {
return apply(this, 'find', fn, thisArg, toReactive)
},

related PR #9511

Note:

  • if we modify the find method signature to add ...args, it will be inconsistent with the native array find method signature
  • like every, filter, findIndex, findLast, findLastIndex, forEach, map, and some also have the same issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions