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

fix(runtime-core): enable config options in beforeCreate and setup #2839

Closed

Conversation

luwuer
Copy link
Contributor

@luwuer luwuer commented Dec 17, 2020

Close #2791

For flexible and be consistent with Vue2.

} = options

const publicThis = instance.proxy!
} = asMixin ? options : publicThis.$options
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $options is a merged options, and the merge strategy is decided by the users, this means:

  1. Unreliable
    Users can return any value by customizing the merge strategy, we need to check them.
  2. Logic conflict with applyOptions
    Now, applyOptions is called recursively when initializing options, but $options may contain options from mixins/extends, do we still need recursive calls?

I think we need to carefully redesign, but indeed, this PR looks more reasonable, compared to #2792

@HcySunYang HcySunYang added the 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. label Mar 29, 2021
@HcySunYang
Copy link
Member

Finally, I gave a more appropriate solution #3600

@HcySunYang HcySunYang removed the 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. label Apr 14, 2021
@posva
Copy link
Member

posva commented Jul 15, 2021

Thanks for the PR. Apparently this got fixed with e2ca67b

@posva posva closed this Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding to this.$options.computed during beforeCreate only works if computed is already defined on component
3 participants