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

Extended array methods are called with unexpected values #11570

Closed
scottbedard opened this issue Aug 8, 2024 · 2 comments · Fixed by #11572
Closed

Extended array methods are called with unexpected values #11570

scottbedard opened this issue Aug 8, 2024 · 2 comments · Fixed by #11572
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. scope: reactivity version: minor

Comments

@scottbedard
Copy link
Contributor

scottbedard commented Aug 8, 2024

Vue version

3.5.0-beta.1

Link to minimal reproduction

3.4.373.5.0-beta.1

Steps to reproduce

  1. Create a class that extends Array
  2. Use super to augment an array method

What is expected?

The extended method should be called with the provided parameter, and be able to forward that parameter to the parent method.

What is actually happening?

The extended method receives a function, regardless of what is provided by the caller.

System Info

System:
    OS: macOS 14.4.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 146.05 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v20.15.0/bin/npm
    pnpm: 9.0.1 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 127.0.6533.99
    Firefox Nightly: 129.0a1
    Safari: 17.4.1
  npmPackages:
    vue: 3.5.0-beta.1 => 3.5.0-beta.1

Any additional comments?

I suspect this is related to the optimized array tracking, but have not isolated the exact cause yet.

#9511

Update: It looks like the issue lies here, our reactivity logic depends on these signatures matching the native array.

@scottbedard scottbedard changed the title Extended array classes cannot overwrite parent methods Extended array methods are called with unexpected values Aug 8, 2024
@jh-leong jh-leong added scope: reactivity 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Aug 8, 2024
@edison1105 edison1105 added version: minor ❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. and removed 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Aug 9, 2024
edison1105 added a commit to edison1105/vuejs-core that referenced this issue Aug 9, 2024
@edison1105 edison1105 linked a pull request Aug 9, 2024 that will close this issue
@yyx990803
Copy link
Member

closed via #11572

@scottbedard
Copy link
Contributor Author

Thank you both, I appreciate all the hard work!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. scope: reactivity version: minor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants