Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

huang-julien
Copy link
Member

πŸ”— Linked issue

fix #26361

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Hi πŸ‘‹ this fix a bug where v-if are not correctly moved from the slot to the wrapper component

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@brc-dd
Copy link

brc-dd commented Mar 20, 2024

There might be cases like v-else-if or v-show too. Is there some generic way to solve this instead of having to list out each directive manually? πŸ‘€

Also, I believe getPropsToString in islandsTransform.ts doesn't handle props with hyphen properly:

getPropsToString({'foo-bar': 'baz'}) // gives --- [{ foo-bar: `baz` }]

which is invalid JS. (maybe needs ${JSON.stringify(name)})

@huang-julien
Copy link
Member Author

indeed thank you ! I'm currently working on changing the way slots and client works internally to make this work for non-SFC too.

For now I think we only need to extract a few directive, I believe we still want to leave directive on the component (other than v-if/else/elseif)

@huang-julien huang-julien marked this pull request as draft March 20, 2024 08:24
@huang-julien huang-julien marked this pull request as ready for review March 23, 2024 22:52
@huang-julien huang-julien requested a review from danielroe March 23, 2024 22:52
@brc-dd
Copy link

brc-dd commented Mar 24, 2024

Also, I believe getPropsToString in islandsTransform.ts doesn't handle props with hyphen properly:

This is still not fixed. Or is it guaranteed that the passed bindings won't contain any name having any character other than :a-zA-Z πŸ‘€

If not, then something like this at line 162 of packages/nuxt/src/components/islandsTransform.ts might be better:

  const content = Object.entries(bindings).filter(b => b[0] && b[0] !== '_bind').map(([name, value]) => isBinding(name) ? `[\`${name.slice(1)}\`]: ${value}` : `[\`${name}\`]: \`${value}\``).join(',')

Co-authored-by:  Divyansh Singh <[email protected]>
@huang-julien
Copy link
Member Author

oops sorry, i completly forgot about that ! thanks !

@danielroe danielroe merged commit 8911c0d into main Mar 25, 2024
@danielroe danielroe deleted the fix/slotvif branch March 25, 2024 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting selectiveClient: 'deep' breaks components with conditional slots
4 participants