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

[Script Setup] Global directives collide with component's local vars #3543

Closed
Sikarii opened this issue Apr 5, 2021 · 3 comments
Closed
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working scope: script-setup scope: sfc

Comments

@Sikarii
Copy link

Sikarii commented Apr 5, 2021

Version

3.0.11

Reproduction link

CodeSandbox will work as expected, as it's seemingly unable to parse the new script setup syntax:
https://codesandbox.io/s/amazing-sun-nn9zt

Steps to reproduce

  1. Register a global directive, name it "focus" and listen for the callback.
  2. Create a SFC with the experimental "script setup" syntax and declare a variable with the same name as the global directive (focus).

What is expected?

The directive callback would be called.

What is actually happening?

The component's local variable seems to override the global directive, thus the callback never firing.

@HcySunYang HcySunYang added 🐞 bug Something isn't working 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. has workaround A workaround has been found to avoid the problem ✨ feature request New feature or request and removed 🐞 bug Something isn't working 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. has workaround A workaround has been found to avoid the problem labels Apr 6, 2021
@HcySunYang
Copy link
Member

This seems inevitable, maybe we need to provide an appropriate warning message for this

@HcySunYang
Copy link
Member

Early similar issues #3275, #3270

@HcySunYang HcySunYang added 🐞 bug Something isn't working 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. and removed ✨ feature request New feature or request labels Apr 6, 2021
@HcySunYang
Copy link
Member

Finally I came up with the solution #3546

@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working scope: script-setup scope: sfc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants