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

Addon-actions: Fix log flushing when story re-renders #12500

Merged
merged 1 commit into from Sep 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions addons/actions/src/containers/ActionLogger/index.tsx
Expand Up @@ -2,7 +2,7 @@ import React, { Component } from 'react';
import deepEqual from 'fast-deep-equal';

import { API } from '@storybook/api';
import { STORY_RENDERED } from '@storybook/core-events';
import { STORY_CHANGED } from '@storybook/core-events';

import { ActionLogger as ActionLoggerComponent } from '../../components/ActionLogger';
import { EVENT_ID } from '../..';
Expand Down Expand Up @@ -39,14 +39,14 @@ export default class ActionLogger extends Component<ActionLoggerProps, ActionLog
const { api } = this.props;

api.on(EVENT_ID, this.addAction);
api.on(STORY_RENDERED, this.handleStoryChange);
api.on(STORY_CHANGED, this.handleStoryChange);
}

componentWillUnmount() {
this.mounted = false;
const { api } = this.props;

api.off(STORY_RENDERED, this.handleStoryChange);
api.off(STORY_CHANGED, this.handleStoryChange);
api.off(EVENT_ID, this.addAction);
}

Expand Down