Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parameter missing in extended array find method #11573

Closed
edison1105 opened this issue Aug 9, 2024 · 0 comments · Fixed by #11574
Closed

parameter missing in extended array find method #11573

edison1105 opened this issue Aug 9, 2024 · 0 comments · Fixed by #11574

Comments

@edison1105
Copy link
Member

edison1105 commented Aug 9, 2024

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
@edison1105 edison1105 changed the title parameter missing in extended array find method, parameter missing in extended array find method Aug 9, 2024
@edison1105 edison1105 added 🐞 bug Something isn't working scope: reactivity labels Aug 9, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants