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

Vue 3.4 issue #32

Closed
kevinwarne opened this issue Feb 1, 2024 · 4 comments
Closed

Vue 3.4 issue #32

kevinwarne opened this issue Feb 1, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@kevinwarne
Copy link

Hi, I am using whyframe with my vitepress based documentation site. (Documenting a vue component library).

I am upgrading to vue 3.4 but this seems to break my examples. Anyone else running into issues with this minor vue update?

@roitto
Copy link

roitto commented Mar 26, 2024

In the vitepress example, the "popup4" component seems to be broken, which uses Story component with slots.

Is this the same problem?

E: Seems to be broken in the vue example too.

@roitto
Copy link

roitto commented Mar 26, 2024

c['content']?.trimLeft().startsWith('<slot')

Seems that checking loc.source for the slot fixes the problem:

            node.children?.some((c) =>
              c['content']?.trimLeft().startsWith('<slot')
              || c['loc']?.source?.trim().startsWith('<slot')
            )

E: Also adding &lt;slot inside the vue components iframe fixes this 😁 Because content property is only found from text nodes.

      <iframe
        data-why
      >
        &lt;slot
        <slot />
      </iframe>

@bluwy
Copy link
Owner

bluwy commented Apr 1, 2024

Thanks for sharing your solution @roitto. I noticed that it's caused by a breaking change in @vue/compiler-dom where between v3.2.47 and v3.4.21, the node children type signature changed from:

[
  {
    type: 2,
    content: '\n        <slot />\n      ',
    loc: {
      start: [Object],
      end: [Object],
      source: '\n        <slot />\n      '
    }
  }
]

to:

[
  {
    type: 1,
    tag: 'slot',
    ns: 0,
    tagType: 2,
    props: [],
    children: [],
    loc: { start: [Object], end: [Object], source: '<slot />' },
    codegenNode: undefined,
    isSelfClosing: true
  }
]

This shouldn't be happening in a minor/patch, but alas I'll make a fix for this to prevent the error.

@bluwy bluwy added the bug Something isn't working label Apr 1, 2024
@bluwy bluwy closed this as completed in 37716a2 Apr 1, 2024
@bluwy
Copy link
Owner

bluwy commented Apr 1, 2024

Fixed in @whyframe/vue v0.1.7 (release)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants