-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Web-components: Fix cleaning Lit Expression comments #18108
Web-components: Fix cleaning Lit Expression comments #18108
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit ea837ca. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
Hello @muratcorlu great contribution! Is this still in draft? What else is there still to do? |
Hello @ndelangen. Sorry, I was on vacation. I wanted to update unit tests for this case but couldn't manage. Some help would be great. Let me try to push my try to discuss on. |
const story = context?.parameters.docs?.source?.excludeDecorators
? (context.originalStoryFn as ArgsStoryFn<WebComponentsFramework>)(context.args, context)
: storyFn(); Here in the sourceDecorator it runs I'm not sure if I understand the meaning of |
Hey @muratcorlu thank you so much for your contribution!
I updated your branch and fixed some TS issues as well as made your test pass. Could you look at it and make sure it will strip the comments correctly?
The storyFn is something a bit more complex, which is prepared in Storybook and has combined decorators as well as a bound context. Even if it's called on its own with no arguments, it will still execute correctly, so that code is correct. I tweaked your test to simulate that behavior. If you want to know more about how stories are prepared you can check here!
Some might want to present the code snippet to users without decorators, and that's why we provide that option. One example is a React component that uses theming and the theming comes from a decorator: const withTheme = (storyFn) => {
return <ThemeProvider>{storyFn()}</ThemeProvider>
}
const myStory = (args) => <Button {...args} /> So you could opt to either get the Button snippet or Button + Provider, by setting the I hope this helps! |
Hi @yannbf Thanks for the fixes and detailed explanation. That really helped me to understand what is happening here. I think currently, this PR fulfills its requirements, but as far as I see, some other tests in the |
Actually it's all good. We are experiencing some issues with both |
I tried to test in our environment, I also needed to link
Does this mean anything to you? |
Hi @yannbf. I managed to test this within our project and I can confirm this works properly to clean Lit expression comments. I also tested on sb@next without copying my local changes and saw the issue again. So, I think we are safe to go. 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thanks for letting me know
Manual modification in storybook configuration is not needed anymore. For more information: storybookjs/storybook#18108
* chore(storybook): storybook upgraded to v6.5.5 * chore(storybook): lit expression comments cleared in v6.5 Manual modification in storybook configuration is not needed anymore. For more information: storybookjs/storybook#18108 Co-authored-by: Murat Çorlu <murat.corlu@trendyol.com>
We are trying to create a design guideline with lit and want to use storybook to document our components. Here is a example story (in mdx format) that I use:
And here the result that Storybook shows in "Show code" panel in the UI:
This fix cleans Lit expression comments from output (
<!--?lit$754556085$-->
)What I did
There was a regexp replace for cleaning comment tags, I just updated this regexp by taking the one from lit-html repository.
How to test
There was no test case related with regexp replace part in current code. I wanted to add extra test cases for this but I'm very confused while I was trying to write it. I'll check it again but creating this draft anyway to be able to share what I'm doing for solving this issue.
I also think updating kitchen sink app with an example that has the condition above will be helpful.