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

Custom options merge order #2040

Closed
skirtles-code opened this issue Sep 3, 2020 · 0 comments · Fixed by #2041
Closed

Custom options merge order #2040

skirtles-code opened this issue Sep 3, 2020 · 0 comments · Fixed by #2041

Comments

@skirtles-code
Copy link
Contributor

Version

3.0.0-rc.10

Reproduction link

https://jsfiddle.net/skirtle/gxou4bqd/1/

Steps to reproduce

The console logging shows the calls made to merge the custom option.

What is expected?

The final result, as seen in the DOM, should be my-child.

What is actually happening?

The global mixin is merged last, so it takes priority.


The problem here is not just with global mixins. The whole merge order for custom options is incorrect.

Here is an equivalent Vue 2 example. It shows the correct order:

https://jsfiddle.net/skirtle/btqcnj3p/1/

There is a spurious merge in Vue 2 that probably shouldn't be there (the one that logs global-mixin to undefined) but it doesn't seem to do any harm. Apart from that, everything happens in the order is should.

Roughly speaking, the correct order of precedence is:

  1. Global mixins (lowest priority)
  2. extends
  3. mixins
  4. The config object itself (highest priority)

For extends and mixins this order should be applied recursively.

It isn't just a problem for custom properties in optionMergeStrategies. Removing the strategy initially seems to fix the problem as the result is my-child. However, if you also remove the custom: 'my-child' it should fall back to mixin, whereas it actually falls back to extends.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant