Skip to content

Reactive state value declared in stories.svelte file does not trigger re-render of component on change: am I missing something? #257

Answered by xeho91
awforsythe asked this question in Q&A
Discussion options

You must be logged in to vote

Hmm... That's an interesting study case. I need to give myself time to study better why your pattern doesn't work. I'm not yet sure if the issue is on your side. Or we're internally breaking something. Or we hit some limitation. Right now, @JReinhold has a better understanding of the runtime part of this addon. But I suspect we might also need @paoloricciuti's help to explain Svelte 5 reactivity for this case.


Regardless, I'll share what will work for your case:

<script module lang="ts">
  import { defineMeta } from '@storybook/addon-svelte-csf';
  import { fn } from '@storybook/test';
  // 👆 Let's give ourselves a better debugging experience
  import MyComponent from './components/Examp…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@JReinhold
Comment options

@paoloricciuti
Comment options

@awforsythe
Comment options

Answer selected by awforsythe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants