How to use the @storybook/core-events.STORY_UNCHANGED function in @storybook/core-events

To help you get started, we’ve selected a few @storybook/core-events examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github storybookjs / storybook / lib / core / src / client / preview / start.js View on Github external
selectedStory: name,
      parameters,
      forceRender,
    };

    // Render story only if selectedKind or selectedStory have changed.
    // However, we DO want the story to re-render if the store itself has changed
    // (which happens at the moment when HMR occurs)
    if (
      !forceRender &&
      revision === previousRevision &&
      viewMode === previousViewMode &&
      kind === previousKind &&
      name === previousStory
    ) {
      addons.getChannel().emit(Events.STORY_UNCHANGED, {
        id,
        revision,
        kind,
        name,
        viewMode,
      });
      return;
    }

    if (!forceRender && previousKind && previousStory) {
      addons.getChannel().emit(Events.STORY_CHANGED, id);
    }

    if (viewMode === 'docs') {
      const NoDocs = () =&gt; <div style="{{">No docs found</div>;
      const StoryDocs = (parameters &amp;&amp; parameters.docs) || NoDocs;