#Unexpected closing tag when using slots

17 messages · Page 1 of 1 (latest)

short badger
#

After updating to SB7-RC1 "formatter-MGIGMU7Y.mjs" throws the error when I try to inject HTML (or custom elements for the matter) into args working as vue slots. Result is no generation of docs.
Both SB6.5 and SB7 implementations via the documentation (template reuse and render function) tried.
`
//sticker.stories.js
const Template = (args) => ({
components: { Sticker },
setup() {
return { args };
},
template: '<Sticker v-bind="args">${args.default}</Sticker>'
});

export const IconVariant = Template.bind({});
IconVariant.args = {
default: '<i class="some-icon"></i>',
};
here</i>` will be unexpected.

Error stack also shows:
react-dom.development.js:20085 The above error occurred in the <SyntaxHighlighter2> component: at SyntaxHighlighter2 (http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-XIM4PSKC.js?v=70f2c8c2:1559:29)

Have I missed some core changes?

simple flame
#

@meager bolt do you know what’s happening here?

@short badger what version did you upgrade from where it was working?

short badger
#

6.5.6

meager bolt
#

The template looks weird for me as ${args.default} shouldn’t work anyway

#

To work in the template should be {{args.default}}

short badger
#

@meager bolt Template literals? Right so I had to change backtick (`) to single quote (') because of Discord formatting. That way I can do multi-line strings for complex markup as prop values. Has always worked for me.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

Template literals are literals delimited with backtick (`) characters, allowing for multi-line strings, string interpolation with embedded expressions, and special constructs called tagged templates.

meager bolt
#

Yes if like that it would work

#

But it willl be static in this case it like creating the template using that arg from the setup, the reason why it works for you maybe it is every time you change the args you recreate again the component it is not reactive in old version I guess

short badger
#

Well it was reactive in the old version.

#

It's not anymore. Just noticed that 😦

#

Yeah there's something very wrong. Props are reactive but slots are completely dead.

short badger
#

I'll try and figure out the exact pattern for this and get back to you.

short badger
keen drum
#

@short badger did you get to the bottom of this issue?
I successfully migrated to Stroybook 7 + Vue3 + Vite setup, but when migrating from CSF2 to CSF3 some stories would not render and threw a similar error.

Unexpected closing tag "div". It may happen when the tag has already been closed by another tag.

#

Simply having mutliple <div></div> blocks in the template : `` would cause this

#

@rose dove

short badger
#

@keen drum I did not.
When you say multiple, are you saying it works with a single div?