<commit_before>import React from 'react';
import { connect as reactReduxConnect } from 'react-redux';
import hoistNonReactStatic from 'hoist-non-react-statics';
import { storeShape, subscriptionShape, resaShape } from './Provider';

const resaKey = 'resa';
const storeKey = 'store';
const subscriptionKey = `${storeKey}Subscription`;

const contextTypes = {
    [storeKey]: storeShape.isRequired,
    [subscriptionKey]: subscriptionShape,
    [resaKey]: resaShape.isRequired,
};

export default function resaConnect(mapStateToProps, mapDispatchToProps, mergeProps, extraOptions) {
    return function wrapWithConnect(WrappedComponent) {
        class Connect extends React.Component {
            constructor(props, context) {
                super(props, context);
                this.resa = context[resaKey];
                this.wrappedInstance = WrappedComponent;
            }

            getChildContext() {
                return {
                    [storeKey]: this.context[storeKey],
                    [subscriptionKey]: this.context[subscriptionKey],
                    [resaKey]: this.context[resaKey],
                };
            }

            render() {
                const newMapStateToProps = (() => {
                    if (mapStateToProps == null) {
                        return null;
                    }
                    return args => mapStateToProps(this.resa, args);
                })();
                const newMapDispatchToProps = (() => {
                    if (mapDispatchToProps == null) {
                        return null;
                    }
                    return dispatch => mapDispatchToProps(this.resa, dispatch);
                })();
                const ConnectedComponent = reactReduxConnect(
                    newMapStateToProps,
                    newMapDispatchToProps,
                    mergeProps,
                    extraOptions)(WrappedComponent);
                return <ConnectedComponent {...this.props} />;
            }
        }

        Connect.WrappedComponent = WrappedComponent;<commit_msg>fix bug: always createElement when mount<commit_after>import React from 'react';
import { connect as reactReduxConnect } from 'react-redux';
import hoistNonReactStatic from 'hoist-non-react-statics';
import { storeShape, subscriptionShape, resaShape } from './Provider';

const resaKey = 'resa';
const storeKey = 'store';
const subscriptionKey = `${storeKey}Subscription`;

const contextTypes = {
    [storeKey]: storeShape.isRequired,
    [subscriptionKey]: subscriptionShape,
    [resaKey]: resaShape.isRequired,
};

export default function resaConnect(mapStateToProps, mapDispatchToProps, mergeProps, extraOptions) {
    return function wrapWithConnect(WrappedComponent) {
        const newMapStateToProps = (() => {
            if (mapStateToProps == null) {
                return null;
            }
            return args => mapStateToProps(this.resa, args);
        })();
        const newMapDispatchToProps = (() => {
            if (mapDispatchToProps == null) {
                return null;
            }
            return dispatch => mapDispatchToProps(this.resa, dispatch);
        })();
        const ConnectedComponent = reactReduxConnect(
            newMapStateToProps,
            newMapDispatchToProps,
            mergeProps,
            extraOptions)(WrappedComponent);

        class Connect extends React.Component {
            constructor(props, context) {
                super(props, context);
                this.resa = context[resaKey];
                this.wrappedInstance = WrappedComponent;
            }

            getChildContext() {
                return {
                    [storeKey]: this.context[storeKey],
                    [subscriptionKey]: this.context[subscriptionKey],
                    [resaKey]: this.context[resaKey],
                };
            }

            render() {
                return <ConnectedComponent {...this.props} />;
            }
        }

        Connect.WrappedComponent = WrappedComponent;
{'fraction_non_alphanumeric': 0.09635288319369148, 'fraction_numerical': 0.0, 'mean_word_length': 1.8766832034018426, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '1403281', 'n_tokens_mistral': 998, 'n_tokens_neox': 964, 'n_words': 208}