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: deoptimize slots when a directive is used #638

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

KaelWD
Copy link
Contributor

@KaelWD KaelWD commented Mar 29, 2023

🤔 What is the nature of this change?

  • New feature
  • Fix bug
  • Style optimization
  • Code style optimization
  • Performance optimization
  • Build optimization
  • Refactor code or style
  • Test related
  • Other

🔗 Related Issue

fixes #541

💡 Background or solution

resolveDirective in an optimized slot uses the child component's scope, so directives registered locally in the parent fail to resolve. To fix this we either need to hoist resolveDirective to setup like vue/compiler-sfc does (not really possible in JSX), or disable slot optimization for all parents.

resolveDirective will not be emitted for directives that are already in scope:

import vDirective

<div v-directive />

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@netlify
Copy link

netlify bot commented Mar 29, 2023

Deploy Preview for vue-jsx-explorer ready!

Name Link
🔨 Latest commit e6cee1a
🔍 Latest deploy log https://app.netlify.com/sites/vue-jsx-explorer/deploys/67b6d1a157d48e0008781645
😎 Deploy Preview https://deploy-preview-638--vue-jsx-explorer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@KaelWD

This comment was marked as outdated.

@KaelWD KaelWD marked this pull request as ready for review March 30, 2023 09:09
@KaelWD KaelWD force-pushed the fix/541-slot-directives branch 4 times, most recently from ca2e782 to 35b5a9c Compare February 19, 2025 08:31
@KaelWD KaelWD force-pushed the fix/541-slot-directives branch from 35b5a9c to 2f75d2f Compare February 19, 2025 08:32
@KaelWD
Copy link
Contributor Author

KaelWD commented Feb 19, 2025

This is ready to merge.

@KaelWD KaelWD force-pushed the fix/541-slot-directives branch from fc7ea37 to e6cee1a Compare February 20, 2025 06:54
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.

[BUG] Directives in slots aren't resolved in the correct context
1 participant