<commit_before>import types from './types';
import { updateCurrentChallenge } from './actions';

export default function resetChallengeSaga(actions$, getState) {
  return actions$
    .filter(({ type }) => type === types.resetChallenge)
    .map(() => {
      const {
        challengesApp: { challenge: dashedName },
        entities: { challenge: challengeMap }
      } = getState();
      const currentChallenge = challengeMap[dashedName];
      return updateCurrentChallenge(currentChallenge);
    });
}<commit_msg>Fix(challenges): reset challenge should update main iframe<commit_after>import { Observable } from 'rx';
import types from './types';
import {
  updateCurrentChallenge,
  updateMain
} from './actions';

export default function resetChallengeSaga(actions$, getState) {
  return actions$
    .filter(({ type }) => type === types.resetChallenge)
    .flatMap(() => {
      const {
        challengesApp: { challenge: dashedName },
        entities: { challenge: challengeMap }
      } = getState();
      const currentChallenge = challengeMap[dashedName];
      return Observable.of(
        updateCurrentChallenge(currentChallenge),
        updateMain()
      );
    });
}
{'fraction_non_alphanumeric': 0.12531539108494533, 'fraction_numerical': 0.0, 'mean_word_length': 3.4402985074626864, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1789127', 'n_tokens_mistral': 329, 'n_tokens_neox': 314, 'n_words': 79}