WIP - add extractor, generate snippet_data
This commit is contained in:
43
node_modules/react-redux/lib/alternate-renderers.js
generated
vendored
Normal file
43
node_modules/react-redux/lib/alternate-renderers.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.batch = void 0;
|
||||
|
||||
var _Provider = _interopRequireDefault(require("./components/Provider"));
|
||||
|
||||
exports.Provider = _Provider["default"];
|
||||
|
||||
var _connectAdvanced = _interopRequireDefault(require("./components/connectAdvanced"));
|
||||
|
||||
exports.connectAdvanced = _connectAdvanced["default"];
|
||||
|
||||
var _Context = require("./components/Context");
|
||||
|
||||
exports.ReactReduxContext = _Context.ReactReduxContext;
|
||||
|
||||
var _connect = _interopRequireDefault(require("./connect/connect"));
|
||||
|
||||
exports.connect = _connect["default"];
|
||||
|
||||
var _useDispatch = require("./hooks/useDispatch");
|
||||
|
||||
exports.useDispatch = _useDispatch.useDispatch;
|
||||
|
||||
var _useSelector = require("./hooks/useSelector");
|
||||
|
||||
exports.useSelector = _useSelector.useSelector;
|
||||
|
||||
var _useStore = require("./hooks/useStore");
|
||||
|
||||
exports.useStore = _useStore.useStore;
|
||||
|
||||
var _batch = require("./utils/batch");
|
||||
|
||||
var _shallowEqual = _interopRequireDefault(require("./utils/shallowEqual"));
|
||||
|
||||
exports.shallowEqual = _shallowEqual["default"];
|
||||
// For other renderers besides ReactDOM and React Native, use the default noop batch function
|
||||
var batch = (0, _batch.getBatch)();
|
||||
exports.batch = batch;
|
||||
14
node_modules/react-redux/lib/components/Context.js
generated
vendored
Normal file
14
node_modules/react-redux/lib/components/Context.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = exports.ReactReduxContext = void 0;
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var ReactReduxContext = _react["default"].createContext(null);
|
||||
|
||||
exports.ReactReduxContext = ReactReduxContext;
|
||||
var _default = ReactReduxContext;
|
||||
exports["default"] = _default;
|
||||
96
node_modules/react-redux/lib/components/Provider.js
generated
vendored
Normal file
96
node_modules/react-redux/lib/components/Provider.js
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
||||
|
||||
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
||||
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
var _Context = require("./Context");
|
||||
|
||||
var _Subscription = _interopRequireDefault(require("../utils/Subscription"));
|
||||
|
||||
var Provider =
|
||||
/*#__PURE__*/
|
||||
function (_Component) {
|
||||
(0, _inheritsLoose2["default"])(Provider, _Component);
|
||||
|
||||
function Provider(props) {
|
||||
var _this;
|
||||
|
||||
_this = _Component.call(this, props) || this;
|
||||
var store = props.store;
|
||||
_this.notifySubscribers = _this.notifySubscribers.bind((0, _assertThisInitialized2["default"])(_this));
|
||||
var subscription = new _Subscription["default"](store);
|
||||
subscription.onStateChange = _this.notifySubscribers;
|
||||
_this.state = {
|
||||
store: store,
|
||||
subscription: subscription
|
||||
};
|
||||
_this.previousState = store.getState();
|
||||
return _this;
|
||||
}
|
||||
|
||||
var _proto = Provider.prototype;
|
||||
|
||||
_proto.componentDidMount = function componentDidMount() {
|
||||
this._isMounted = true;
|
||||
this.state.subscription.trySubscribe();
|
||||
|
||||
if (this.previousState !== this.props.store.getState()) {
|
||||
this.state.subscription.notifyNestedSubs();
|
||||
}
|
||||
};
|
||||
|
||||
_proto.componentWillUnmount = function componentWillUnmount() {
|
||||
if (this.unsubscribe) this.unsubscribe();
|
||||
this.state.subscription.tryUnsubscribe();
|
||||
this._isMounted = false;
|
||||
};
|
||||
|
||||
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
||||
if (this.props.store !== prevProps.store) {
|
||||
this.state.subscription.tryUnsubscribe();
|
||||
var subscription = new _Subscription["default"](this.props.store);
|
||||
subscription.onStateChange = this.notifySubscribers;
|
||||
this.setState({
|
||||
store: this.props.store,
|
||||
subscription: subscription
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
_proto.notifySubscribers = function notifySubscribers() {
|
||||
this.state.subscription.notifyNestedSubs();
|
||||
};
|
||||
|
||||
_proto.render = function render() {
|
||||
var Context = this.props.context || _Context.ReactReduxContext;
|
||||
return _react["default"].createElement(Context.Provider, {
|
||||
value: this.state
|
||||
}, this.props.children);
|
||||
};
|
||||
|
||||
return Provider;
|
||||
}(_react.Component);
|
||||
|
||||
Provider.propTypes = {
|
||||
store: _propTypes["default"].shape({
|
||||
subscribe: _propTypes["default"].func.isRequired,
|
||||
dispatch: _propTypes["default"].func.isRequired,
|
||||
getState: _propTypes["default"].func.isRequired
|
||||
}),
|
||||
context: _propTypes["default"].object,
|
||||
children: _propTypes["default"].any
|
||||
};
|
||||
var _default = Provider;
|
||||
exports["default"] = _default;
|
||||
361
node_modules/react-redux/lib/components/connectAdvanced.js
generated
vendored
Normal file
361
node_modules/react-redux/lib/components/connectAdvanced.js
generated
vendored
Normal file
@ -0,0 +1,361 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = connectAdvanced;
|
||||
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
|
||||
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
|
||||
|
||||
var _invariant = _interopRequireDefault(require("invariant"));
|
||||
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _reactIs = require("react-is");
|
||||
|
||||
var _Subscription = _interopRequireDefault(require("../utils/Subscription"));
|
||||
|
||||
var _Context = require("./Context");
|
||||
|
||||
// Define some constant arrays just to avoid re-creating these
|
||||
var EMPTY_ARRAY = [];
|
||||
var NO_SUBSCRIPTION_ARRAY = [null, null];
|
||||
|
||||
var stringifyComponent = function stringifyComponent(Comp) {
|
||||
try {
|
||||
return JSON.stringify(Comp);
|
||||
} catch (err) {
|
||||
return String(Comp);
|
||||
}
|
||||
};
|
||||
|
||||
function storeStateUpdatesReducer(state, action) {
|
||||
var updateCount = state[1];
|
||||
return [action.payload, updateCount + 1];
|
||||
}
|
||||
|
||||
var initStateUpdates = function initStateUpdates() {
|
||||
return [null, 0];
|
||||
}; // React currently throws a warning when using useLayoutEffect on the server.
|
||||
// To get around it, we can conditionally useEffect on the server (no-op) and
|
||||
// useLayoutEffect in the browser. We need useLayoutEffect because we want
|
||||
// `connect` to perform sync updates to a ref to save the latest props after
|
||||
// a render is actually committed to the DOM.
|
||||
|
||||
|
||||
var useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? _react.useLayoutEffect : _react.useEffect;
|
||||
|
||||
function connectAdvanced(
|
||||
/*
|
||||
selectorFactory is a func that is responsible for returning the selector function used to
|
||||
compute new props from state, props, and dispatch. For example:
|
||||
export default connectAdvanced((dispatch, options) => (state, props) => ({
|
||||
thing: state.things[props.thingId],
|
||||
saveThing: fields => dispatch(actionCreators.saveThing(props.thingId, fields)),
|
||||
}))(YourComponent)
|
||||
Access to dispatch is provided to the factory so selectorFactories can bind actionCreators
|
||||
outside of their selector as an optimization. Options passed to connectAdvanced are passed to
|
||||
the selectorFactory, along with displayName and WrappedComponent, as the second argument.
|
||||
Note that selectorFactory is responsible for all caching/memoization of inbound and outbound
|
||||
props. Do not use connectAdvanced directly without memoizing results between calls to your
|
||||
selector, otherwise the Connect component will re-render on every state or props change.
|
||||
*/
|
||||
selectorFactory, // options object:
|
||||
_ref) {
|
||||
if (_ref === void 0) {
|
||||
_ref = {};
|
||||
}
|
||||
|
||||
var _ref2 = _ref,
|
||||
_ref2$getDisplayName = _ref2.getDisplayName,
|
||||
getDisplayName = _ref2$getDisplayName === void 0 ? function (name) {
|
||||
return "ConnectAdvanced(" + name + ")";
|
||||
} : _ref2$getDisplayName,
|
||||
_ref2$methodName = _ref2.methodName,
|
||||
methodName = _ref2$methodName === void 0 ? 'connectAdvanced' : _ref2$methodName,
|
||||
_ref2$renderCountProp = _ref2.renderCountProp,
|
||||
renderCountProp = _ref2$renderCountProp === void 0 ? undefined : _ref2$renderCountProp,
|
||||
_ref2$shouldHandleSta = _ref2.shouldHandleStateChanges,
|
||||
shouldHandleStateChanges = _ref2$shouldHandleSta === void 0 ? true : _ref2$shouldHandleSta,
|
||||
_ref2$storeKey = _ref2.storeKey,
|
||||
storeKey = _ref2$storeKey === void 0 ? 'store' : _ref2$storeKey,
|
||||
_ref2$withRef = _ref2.withRef,
|
||||
withRef = _ref2$withRef === void 0 ? false : _ref2$withRef,
|
||||
_ref2$forwardRef = _ref2.forwardRef,
|
||||
forwardRef = _ref2$forwardRef === void 0 ? false : _ref2$forwardRef,
|
||||
_ref2$context = _ref2.context,
|
||||
context = _ref2$context === void 0 ? _Context.ReactReduxContext : _ref2$context,
|
||||
connectOptions = (0, _objectWithoutPropertiesLoose2["default"])(_ref2, ["getDisplayName", "methodName", "renderCountProp", "shouldHandleStateChanges", "storeKey", "withRef", "forwardRef", "context"]);
|
||||
(0, _invariant["default"])(renderCountProp === undefined, "renderCountProp is removed. render counting is built into the latest React Dev Tools profiling extension");
|
||||
(0, _invariant["default"])(!withRef, 'withRef is removed. To access the wrapped instance, use a ref on the connected component');
|
||||
var customStoreWarningMessage = 'To use a custom Redux store for specific components, create a custom React context with ' + "React.createContext(), and pass the context object to React Redux's Provider and specific components" + ' like: <Provider context={MyContext}><ConnectedComponent context={MyContext} /></Provider>. ' + 'You may also pass a {context : MyContext} option to connect';
|
||||
(0, _invariant["default"])(storeKey === 'store', 'storeKey has been removed and does not do anything. ' + customStoreWarningMessage);
|
||||
var Context = context;
|
||||
return function wrapWithConnect(WrappedComponent) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
(0, _invariant["default"])((0, _reactIs.isValidElementType)(WrappedComponent), "You must pass a component to the function returned by " + (methodName + ". Instead received " + stringifyComponent(WrappedComponent)));
|
||||
}
|
||||
|
||||
var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
||||
var displayName = getDisplayName(wrappedComponentName);
|
||||
var selectorFactoryOptions = (0, _extends2["default"])({}, connectOptions, {
|
||||
getDisplayName: getDisplayName,
|
||||
methodName: methodName,
|
||||
renderCountProp: renderCountProp,
|
||||
shouldHandleStateChanges: shouldHandleStateChanges,
|
||||
storeKey: storeKey,
|
||||
displayName: displayName,
|
||||
wrappedComponentName: wrappedComponentName,
|
||||
WrappedComponent: WrappedComponent
|
||||
});
|
||||
var pure = connectOptions.pure;
|
||||
|
||||
function createChildSelector(store) {
|
||||
return selectorFactory(store.dispatch, selectorFactoryOptions);
|
||||
} // If we aren't running in "pure" mode, we don't want to memoize values.
|
||||
// To avoid conditionally calling hooks, we fall back to a tiny wrapper
|
||||
// that just executes the given callback immediately.
|
||||
|
||||
|
||||
var usePureOnlyMemo = pure ? _react.useMemo : function (callback) {
|
||||
return callback();
|
||||
};
|
||||
|
||||
function ConnectFunction(props) {
|
||||
var _useMemo = (0, _react.useMemo)(function () {
|
||||
// Distinguish between actual "data" props that were passed to the wrapper component,
|
||||
// and values needed to control behavior (forwarded refs, alternate context instances).
|
||||
// To maintain the wrapperProps object reference, memoize this destructuring.
|
||||
var forwardedRef = props.forwardedRef,
|
||||
wrapperProps = (0, _objectWithoutPropertiesLoose2["default"])(props, ["forwardedRef"]);
|
||||
return [props.context, forwardedRef, wrapperProps];
|
||||
}, [props]),
|
||||
propsContext = _useMemo[0],
|
||||
forwardedRef = _useMemo[1],
|
||||
wrapperProps = _useMemo[2];
|
||||
|
||||
var ContextToUse = (0, _react.useMemo)(function () {
|
||||
// Users may optionally pass in a custom context instance to use instead of our ReactReduxContext.
|
||||
// Memoize the check that determines which context instance we should use.
|
||||
return propsContext && propsContext.Consumer && (0, _reactIs.isContextConsumer)(_react["default"].createElement(propsContext.Consumer, null)) ? propsContext : Context;
|
||||
}, [propsContext, Context]); // Retrieve the store and ancestor subscription via context, if available
|
||||
|
||||
var contextValue = (0, _react.useContext)(ContextToUse); // The store _must_ exist as either a prop or in context
|
||||
|
||||
var didStoreComeFromProps = Boolean(props.store);
|
||||
var didStoreComeFromContext = Boolean(contextValue) && Boolean(contextValue.store);
|
||||
(0, _invariant["default"])(didStoreComeFromProps || didStoreComeFromContext, "Could not find \"store\" in the context of " + ("\"" + displayName + "\". Either wrap the root component in a <Provider>, ") + "or pass a custom React context provider to <Provider> and the corresponding " + ("React context consumer to " + displayName + " in connect options."));
|
||||
var store = props.store || contextValue.store;
|
||||
var childPropsSelector = (0, _react.useMemo)(function () {
|
||||
// The child props selector needs the store reference as an input.
|
||||
// Re-create this selector whenever the store changes.
|
||||
return createChildSelector(store);
|
||||
}, [store]);
|
||||
|
||||
var _useMemo2 = (0, _react.useMemo)(function () {
|
||||
if (!shouldHandleStateChanges) return NO_SUBSCRIPTION_ARRAY; // This Subscription's source should match where store came from: props vs. context. A component
|
||||
// connected to the store via props shouldn't use subscription from context, or vice versa.
|
||||
|
||||
var subscription = new _Subscription["default"](store, didStoreComeFromProps ? null : contextValue.subscription); // `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in
|
||||
// the middle of the notification loop, where `subscription` will then be null. This can
|
||||
// probably be avoided if Subscription's listeners logic is changed to not call listeners
|
||||
// that have been unsubscribed in the middle of the notification loop.
|
||||
|
||||
var notifyNestedSubs = subscription.notifyNestedSubs.bind(subscription);
|
||||
return [subscription, notifyNestedSubs];
|
||||
}, [store, didStoreComeFromProps, contextValue]),
|
||||
subscription = _useMemo2[0],
|
||||
notifyNestedSubs = _useMemo2[1]; // Determine what {store, subscription} value should be put into nested context, if necessary,
|
||||
// and memoize that value to avoid unnecessary context updates.
|
||||
|
||||
|
||||
var overriddenContextValue = (0, _react.useMemo)(function () {
|
||||
if (didStoreComeFromProps) {
|
||||
// This component is directly subscribed to a store from props.
|
||||
// We don't want descendants reading from this store - pass down whatever
|
||||
// the existing context value is from the nearest connected ancestor.
|
||||
return contextValue;
|
||||
} // Otherwise, put this component's subscription instance into context, so that
|
||||
// connected descendants won't update until after this component is done
|
||||
|
||||
|
||||
return (0, _extends2["default"])({}, contextValue, {
|
||||
subscription: subscription
|
||||
});
|
||||
}, [didStoreComeFromProps, contextValue, subscription]); // We need to force this wrapper component to re-render whenever a Redux store update
|
||||
// causes a change to the calculated child component props (or we caught an error in mapState)
|
||||
|
||||
var _useReducer = (0, _react.useReducer)(storeStateUpdatesReducer, EMPTY_ARRAY, initStateUpdates),
|
||||
_useReducer$ = _useReducer[0],
|
||||
previousStateUpdateResult = _useReducer$[0],
|
||||
forceComponentUpdateDispatch = _useReducer[1]; // Propagate any mapState/mapDispatch errors upwards
|
||||
|
||||
|
||||
if (previousStateUpdateResult && previousStateUpdateResult.error) {
|
||||
throw previousStateUpdateResult.error;
|
||||
} // Set up refs to coordinate values between the subscription effect and the render logic
|
||||
|
||||
|
||||
var lastChildProps = (0, _react.useRef)();
|
||||
var lastWrapperProps = (0, _react.useRef)(wrapperProps);
|
||||
var childPropsFromStoreUpdate = (0, _react.useRef)();
|
||||
var renderIsScheduled = (0, _react.useRef)(false);
|
||||
var actualChildProps = usePureOnlyMemo(function () {
|
||||
// Tricky logic here:
|
||||
// - This render may have been triggered by a Redux store update that produced new child props
|
||||
// - However, we may have gotten new wrapper props after that
|
||||
// If we have new child props, and the same wrapper props, we know we should use the new child props as-is.
|
||||
// But, if we have new wrapper props, those might change the child props, so we have to recalculate things.
|
||||
// So, we'll use the child props from store update only if the wrapper props are the same as last time.
|
||||
if (childPropsFromStoreUpdate.current && wrapperProps === lastWrapperProps.current) {
|
||||
return childPropsFromStoreUpdate.current;
|
||||
} // TODO We're reading the store directly in render() here. Bad idea?
|
||||
// This will likely cause Bad Things (TM) to happen in Concurrent Mode.
|
||||
// Note that we do this because on renders _not_ caused by store updates, we need the latest store state
|
||||
// to determine what the child props should be.
|
||||
|
||||
|
||||
return childPropsSelector(store.getState(), wrapperProps);
|
||||
}, [store, previousStateUpdateResult, wrapperProps]); // We need this to execute synchronously every time we re-render. However, React warns
|
||||
// about useLayoutEffect in SSR, so we try to detect environment and fall back to
|
||||
// just useEffect instead to avoid the warning, since neither will run anyway.
|
||||
|
||||
useIsomorphicLayoutEffect(function () {
|
||||
// We want to capture the wrapper props and child props we used for later comparisons
|
||||
lastWrapperProps.current = wrapperProps;
|
||||
lastChildProps.current = actualChildProps;
|
||||
renderIsScheduled.current = false; // If the render was from a store update, clear out that reference and cascade the subscriber update
|
||||
|
||||
if (childPropsFromStoreUpdate.current) {
|
||||
childPropsFromStoreUpdate.current = null;
|
||||
notifyNestedSubs();
|
||||
}
|
||||
}); // Our re-subscribe logic only runs when the store/subscription setup changes
|
||||
|
||||
useIsomorphicLayoutEffect(function () {
|
||||
// If we're not subscribed to the store, nothing to do here
|
||||
if (!shouldHandleStateChanges) return; // Capture values for checking if and when this component unmounts
|
||||
|
||||
var didUnsubscribe = false;
|
||||
var lastThrownError = null; // We'll run this callback every time a store subscription update propagates to this component
|
||||
|
||||
var checkForUpdates = function checkForUpdates() {
|
||||
if (didUnsubscribe) {
|
||||
// Don't run stale listeners.
|
||||
// Redux doesn't guarantee unsubscriptions happen until next dispatch.
|
||||
return;
|
||||
}
|
||||
|
||||
var latestStoreState = store.getState();
|
||||
var newChildProps, error;
|
||||
|
||||
try {
|
||||
// Actually run the selector with the most recent store state and wrapper props
|
||||
// to determine what the child props should be
|
||||
newChildProps = childPropsSelector(latestStoreState, lastWrapperProps.current);
|
||||
} catch (e) {
|
||||
error = e;
|
||||
lastThrownError = e;
|
||||
}
|
||||
|
||||
if (!error) {
|
||||
lastThrownError = null;
|
||||
} // If the child props haven't changed, nothing to do here - cascade the subscription update
|
||||
|
||||
|
||||
if (newChildProps === lastChildProps.current) {
|
||||
if (!renderIsScheduled.current) {
|
||||
notifyNestedSubs();
|
||||
}
|
||||
} else {
|
||||
// Save references to the new child props. Note that we track the "child props from store update"
|
||||
// as a ref instead of a useState/useReducer because we need a way to determine if that value has
|
||||
// been processed. If this went into useState/useReducer, we couldn't clear out the value without
|
||||
// forcing another re-render, which we don't want.
|
||||
lastChildProps.current = newChildProps;
|
||||
childPropsFromStoreUpdate.current = newChildProps;
|
||||
renderIsScheduled.current = true; // If the child props _did_ change (or we caught an error), this wrapper component needs to re-render
|
||||
|
||||
forceComponentUpdateDispatch({
|
||||
type: 'STORE_UPDATED',
|
||||
payload: {
|
||||
latestStoreState: latestStoreState,
|
||||
error: error
|
||||
}
|
||||
});
|
||||
}
|
||||
}; // Actually subscribe to the nearest connected ancestor (or store)
|
||||
|
||||
|
||||
subscription.onStateChange = checkForUpdates;
|
||||
subscription.trySubscribe(); // Pull data from the store after first render in case the store has
|
||||
// changed since we began.
|
||||
|
||||
checkForUpdates();
|
||||
|
||||
var unsubscribeWrapper = function unsubscribeWrapper() {
|
||||
didUnsubscribe = true;
|
||||
subscription.tryUnsubscribe();
|
||||
|
||||
if (lastThrownError) {
|
||||
// It's possible that we caught an error due to a bad mapState function, but the
|
||||
// parent re-rendered without this component and we're about to unmount.
|
||||
// This shouldn't happen as long as we do top-down subscriptions correctly, but
|
||||
// if we ever do those wrong, this throw will surface the error in our tests.
|
||||
// In that case, throw the error from here so it doesn't get lost.
|
||||
throw lastThrownError;
|
||||
}
|
||||
};
|
||||
|
||||
return unsubscribeWrapper;
|
||||
}, [store, subscription, childPropsSelector]); // Now that all that's done, we can finally try to actually render the child component.
|
||||
// We memoize the elements for the rendered child component as an optimization.
|
||||
|
||||
var renderedWrappedComponent = (0, _react.useMemo)(function () {
|
||||
return _react["default"].createElement(WrappedComponent, (0, _extends2["default"])({}, actualChildProps, {
|
||||
ref: forwardedRef
|
||||
}));
|
||||
}, [forwardedRef, WrappedComponent, actualChildProps]); // If React sees the exact same element reference as last time, it bails out of re-rendering
|
||||
// that child, same as if it was wrapped in React.memo() or returned false from shouldComponentUpdate.
|
||||
|
||||
var renderedChild = (0, _react.useMemo)(function () {
|
||||
if (shouldHandleStateChanges) {
|
||||
// If this component is subscribed to store updates, we need to pass its own
|
||||
// subscription instance down to our descendants. That means rendering the same
|
||||
// Context instance, and putting a different value into the context.
|
||||
return _react["default"].createElement(ContextToUse.Provider, {
|
||||
value: overriddenContextValue
|
||||
}, renderedWrappedComponent);
|
||||
}
|
||||
|
||||
return renderedWrappedComponent;
|
||||
}, [ContextToUse, renderedWrappedComponent, overriddenContextValue]);
|
||||
return renderedChild;
|
||||
} // If we're in "pure" mode, ensure our wrapper component only re-renders when incoming props have changed.
|
||||
|
||||
|
||||
var Connect = pure ? _react["default"].memo(ConnectFunction) : ConnectFunction;
|
||||
Connect.WrappedComponent = WrappedComponent;
|
||||
Connect.displayName = displayName;
|
||||
|
||||
if (forwardRef) {
|
||||
var forwarded = _react["default"].forwardRef(function forwardConnectRef(props, ref) {
|
||||
return _react["default"].createElement(Connect, (0, _extends2["default"])({}, props, {
|
||||
forwardedRef: ref
|
||||
}));
|
||||
});
|
||||
|
||||
forwarded.displayName = displayName;
|
||||
forwarded.WrappedComponent = WrappedComponent;
|
||||
return (0, _hoistNonReactStatics["default"])(forwarded, WrappedComponent);
|
||||
}
|
||||
|
||||
return (0, _hoistNonReactStatics["default"])(Connect, WrappedComponent);
|
||||
};
|
||||
}
|
||||
115
node_modules/react-redux/lib/connect/connect.js
generated
vendored
Normal file
115
node_modules/react-redux/lib/connect/connect.js
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.createConnect = createConnect;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
|
||||
var _connectAdvanced = _interopRequireDefault(require("../components/connectAdvanced"));
|
||||
|
||||
var _shallowEqual = _interopRequireDefault(require("../utils/shallowEqual"));
|
||||
|
||||
var _mapDispatchToProps = _interopRequireDefault(require("./mapDispatchToProps"));
|
||||
|
||||
var _mapStateToProps = _interopRequireDefault(require("./mapStateToProps"));
|
||||
|
||||
var _mergeProps = _interopRequireDefault(require("./mergeProps"));
|
||||
|
||||
var _selectorFactory = _interopRequireDefault(require("./selectorFactory"));
|
||||
|
||||
/*
|
||||
connect is a facade over connectAdvanced. It turns its args into a compatible
|
||||
selectorFactory, which has the signature:
|
||||
|
||||
(dispatch, options) => (nextState, nextOwnProps) => nextFinalProps
|
||||
|
||||
connect passes its args to connectAdvanced as options, which will in turn pass them to
|
||||
selectorFactory each time a Connect component instance is instantiated or hot reloaded.
|
||||
|
||||
selectorFactory returns a final props selector from its mapStateToProps,
|
||||
mapStateToPropsFactories, mapDispatchToProps, mapDispatchToPropsFactories, mergeProps,
|
||||
mergePropsFactories, and pure args.
|
||||
|
||||
The resulting final props selector is called by the Connect component instance whenever
|
||||
it receives new props or store state.
|
||||
*/
|
||||
function match(arg, factories, name) {
|
||||
for (var i = factories.length - 1; i >= 0; i--) {
|
||||
var result = factories[i](arg);
|
||||
if (result) return result;
|
||||
}
|
||||
|
||||
return function (dispatch, options) {
|
||||
throw new Error("Invalid value of type " + typeof arg + " for " + name + " argument when connecting component " + options.wrappedComponentName + ".");
|
||||
};
|
||||
}
|
||||
|
||||
function strictEqual(a, b) {
|
||||
return a === b;
|
||||
} // createConnect with default args builds the 'official' connect behavior. Calling it with
|
||||
// different options opens up some testing and extensibility scenarios
|
||||
|
||||
|
||||
function createConnect(_temp) {
|
||||
var _ref = _temp === void 0 ? {} : _temp,
|
||||
_ref$connectHOC = _ref.connectHOC,
|
||||
connectHOC = _ref$connectHOC === void 0 ? _connectAdvanced["default"] : _ref$connectHOC,
|
||||
_ref$mapStateToPropsF = _ref.mapStateToPropsFactories,
|
||||
mapStateToPropsFactories = _ref$mapStateToPropsF === void 0 ? _mapStateToProps["default"] : _ref$mapStateToPropsF,
|
||||
_ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories,
|
||||
mapDispatchToPropsFactories = _ref$mapDispatchToPro === void 0 ? _mapDispatchToProps["default"] : _ref$mapDispatchToPro,
|
||||
_ref$mergePropsFactor = _ref.mergePropsFactories,
|
||||
mergePropsFactories = _ref$mergePropsFactor === void 0 ? _mergeProps["default"] : _ref$mergePropsFactor,
|
||||
_ref$selectorFactory = _ref.selectorFactory,
|
||||
selectorFactory = _ref$selectorFactory === void 0 ? _selectorFactory["default"] : _ref$selectorFactory;
|
||||
|
||||
return function connect(mapStateToProps, mapDispatchToProps, mergeProps, _ref2) {
|
||||
if (_ref2 === void 0) {
|
||||
_ref2 = {};
|
||||
}
|
||||
|
||||
var _ref3 = _ref2,
|
||||
_ref3$pure = _ref3.pure,
|
||||
pure = _ref3$pure === void 0 ? true : _ref3$pure,
|
||||
_ref3$areStatesEqual = _ref3.areStatesEqual,
|
||||
areStatesEqual = _ref3$areStatesEqual === void 0 ? strictEqual : _ref3$areStatesEqual,
|
||||
_ref3$areOwnPropsEqua = _ref3.areOwnPropsEqual,
|
||||
areOwnPropsEqual = _ref3$areOwnPropsEqua === void 0 ? _shallowEqual["default"] : _ref3$areOwnPropsEqua,
|
||||
_ref3$areStatePropsEq = _ref3.areStatePropsEqual,
|
||||
areStatePropsEqual = _ref3$areStatePropsEq === void 0 ? _shallowEqual["default"] : _ref3$areStatePropsEq,
|
||||
_ref3$areMergedPropsE = _ref3.areMergedPropsEqual,
|
||||
areMergedPropsEqual = _ref3$areMergedPropsE === void 0 ? _shallowEqual["default"] : _ref3$areMergedPropsE,
|
||||
extraOptions = (0, _objectWithoutPropertiesLoose2["default"])(_ref3, ["pure", "areStatesEqual", "areOwnPropsEqual", "areStatePropsEqual", "areMergedPropsEqual"]);
|
||||
var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps');
|
||||
var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps');
|
||||
var initMergeProps = match(mergeProps, mergePropsFactories, 'mergeProps');
|
||||
return connectHOC(selectorFactory, (0, _extends2["default"])({
|
||||
// used in error messages
|
||||
methodName: 'connect',
|
||||
// used to compute Connect's displayName from the wrapped component's displayName.
|
||||
getDisplayName: function getDisplayName(name) {
|
||||
return "Connect(" + name + ")";
|
||||
},
|
||||
// if mapStateToProps is falsy, the Connect component doesn't subscribe to store state changes
|
||||
shouldHandleStateChanges: Boolean(mapStateToProps),
|
||||
// passed through to selectorFactory
|
||||
initMapStateToProps: initMapStateToProps,
|
||||
initMapDispatchToProps: initMapDispatchToProps,
|
||||
initMergeProps: initMergeProps,
|
||||
pure: pure,
|
||||
areStatesEqual: areStatesEqual,
|
||||
areOwnPropsEqual: areOwnPropsEqual,
|
||||
areStatePropsEqual: areStatePropsEqual,
|
||||
areMergedPropsEqual: areMergedPropsEqual
|
||||
}, extraOptions));
|
||||
};
|
||||
}
|
||||
|
||||
var _default = createConnect();
|
||||
|
||||
exports["default"] = _default;
|
||||
32
node_modules/react-redux/lib/connect/mapDispatchToProps.js
generated
vendored
Normal file
32
node_modules/react-redux/lib/connect/mapDispatchToProps.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.whenMapDispatchToPropsIsFunction = whenMapDispatchToPropsIsFunction;
|
||||
exports.whenMapDispatchToPropsIsMissing = whenMapDispatchToPropsIsMissing;
|
||||
exports.whenMapDispatchToPropsIsObject = whenMapDispatchToPropsIsObject;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _redux = require("redux");
|
||||
|
||||
var _wrapMapToProps = require("./wrapMapToProps");
|
||||
|
||||
function whenMapDispatchToPropsIsFunction(mapDispatchToProps) {
|
||||
return typeof mapDispatchToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapDispatchToProps, 'mapDispatchToProps') : undefined;
|
||||
}
|
||||
|
||||
function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {
|
||||
return !mapDispatchToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) {
|
||||
return {
|
||||
dispatch: dispatch
|
||||
};
|
||||
}) : undefined;
|
||||
}
|
||||
|
||||
function whenMapDispatchToPropsIsObject(mapDispatchToProps) {
|
||||
return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) {
|
||||
return (0, _redux.bindActionCreators)(mapDispatchToProps, dispatch);
|
||||
}) : undefined;
|
||||
}
|
||||
|
||||
var _default = [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject];
|
||||
exports["default"] = _default;
|
||||
21
node_modules/react-redux/lib/connect/mapStateToProps.js
generated
vendored
Normal file
21
node_modules/react-redux/lib/connect/mapStateToProps.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.whenMapStateToPropsIsFunction = whenMapStateToPropsIsFunction;
|
||||
exports.whenMapStateToPropsIsMissing = whenMapStateToPropsIsMissing;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _wrapMapToProps = require("./wrapMapToProps");
|
||||
|
||||
function whenMapStateToPropsIsFunction(mapStateToProps) {
|
||||
return typeof mapStateToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapStateToProps, 'mapStateToProps') : undefined;
|
||||
}
|
||||
|
||||
function whenMapStateToPropsIsMissing(mapStateToProps) {
|
||||
return !mapStateToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function () {
|
||||
return {};
|
||||
}) : undefined;
|
||||
}
|
||||
|
||||
var _default = [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing];
|
||||
exports["default"] = _default;
|
||||
54
node_modules/react-redux/lib/connect/mergeProps.js
generated
vendored
Normal file
54
node_modules/react-redux/lib/connect/mergeProps.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.defaultMergeProps = defaultMergeProps;
|
||||
exports.wrapMergePropsFunc = wrapMergePropsFunc;
|
||||
exports.whenMergePropsIsFunction = whenMergePropsIsFunction;
|
||||
exports.whenMergePropsIsOmitted = whenMergePropsIsOmitted;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
|
||||
var _verifyPlainObject = _interopRequireDefault(require("../utils/verifyPlainObject"));
|
||||
|
||||
function defaultMergeProps(stateProps, dispatchProps, ownProps) {
|
||||
return (0, _extends2["default"])({}, ownProps, stateProps, dispatchProps);
|
||||
}
|
||||
|
||||
function wrapMergePropsFunc(mergeProps) {
|
||||
return function initMergePropsProxy(dispatch, _ref) {
|
||||
var displayName = _ref.displayName,
|
||||
pure = _ref.pure,
|
||||
areMergedPropsEqual = _ref.areMergedPropsEqual;
|
||||
var hasRunOnce = false;
|
||||
var mergedProps;
|
||||
return function mergePropsProxy(stateProps, dispatchProps, ownProps) {
|
||||
var nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
||||
|
||||
if (hasRunOnce) {
|
||||
if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps;
|
||||
} else {
|
||||
hasRunOnce = true;
|
||||
mergedProps = nextMergedProps;
|
||||
if (process.env.NODE_ENV !== 'production') (0, _verifyPlainObject["default"])(mergedProps, displayName, 'mergeProps');
|
||||
}
|
||||
|
||||
return mergedProps;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
function whenMergePropsIsFunction(mergeProps) {
|
||||
return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined;
|
||||
}
|
||||
|
||||
function whenMergePropsIsOmitted(mergeProps) {
|
||||
return !mergeProps ? function () {
|
||||
return defaultMergeProps;
|
||||
} : undefined;
|
||||
}
|
||||
|
||||
var _default = [whenMergePropsIsFunction, whenMergePropsIsOmitted];
|
||||
exports["default"] = _default;
|
||||
99
node_modules/react-redux/lib/connect/selectorFactory.js
generated
vendored
Normal file
99
node_modules/react-redux/lib/connect/selectorFactory.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.impureFinalPropsSelectorFactory = impureFinalPropsSelectorFactory;
|
||||
exports.pureFinalPropsSelectorFactory = pureFinalPropsSelectorFactory;
|
||||
exports["default"] = finalPropsSelectorFactory;
|
||||
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
|
||||
var _verifySubselectors = _interopRequireDefault(require("./verifySubselectors"));
|
||||
|
||||
function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) {
|
||||
return function impureFinalPropsSelector(state, ownProps) {
|
||||
return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps);
|
||||
};
|
||||
}
|
||||
|
||||
function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) {
|
||||
var areStatesEqual = _ref.areStatesEqual,
|
||||
areOwnPropsEqual = _ref.areOwnPropsEqual,
|
||||
areStatePropsEqual = _ref.areStatePropsEqual;
|
||||
var hasRunAtLeastOnce = false;
|
||||
var state;
|
||||
var ownProps;
|
||||
var stateProps;
|
||||
var dispatchProps;
|
||||
var mergedProps;
|
||||
|
||||
function handleFirstCall(firstState, firstOwnProps) {
|
||||
state = firstState;
|
||||
ownProps = firstOwnProps;
|
||||
stateProps = mapStateToProps(state, ownProps);
|
||||
dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
||||
mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
||||
hasRunAtLeastOnce = true;
|
||||
return mergedProps;
|
||||
}
|
||||
|
||||
function handleNewPropsAndNewState() {
|
||||
stateProps = mapStateToProps(state, ownProps);
|
||||
if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
||||
mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
||||
return mergedProps;
|
||||
}
|
||||
|
||||
function handleNewProps() {
|
||||
if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps);
|
||||
if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
||||
mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
||||
return mergedProps;
|
||||
}
|
||||
|
||||
function handleNewState() {
|
||||
var nextStateProps = mapStateToProps(state, ownProps);
|
||||
var statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps);
|
||||
stateProps = nextStateProps;
|
||||
if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
||||
return mergedProps;
|
||||
}
|
||||
|
||||
function handleSubsequentCalls(nextState, nextOwnProps) {
|
||||
var propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps);
|
||||
var stateChanged = !areStatesEqual(nextState, state);
|
||||
state = nextState;
|
||||
ownProps = nextOwnProps;
|
||||
if (propsChanged && stateChanged) return handleNewPropsAndNewState();
|
||||
if (propsChanged) return handleNewProps();
|
||||
if (stateChanged) return handleNewState();
|
||||
return mergedProps;
|
||||
}
|
||||
|
||||
return function pureFinalPropsSelector(nextState, nextOwnProps) {
|
||||
return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps);
|
||||
};
|
||||
} // TODO: Add more comments
|
||||
// If pure is true, the selector returned by selectorFactory will memoize its results,
|
||||
// allowing connectAdvanced's shouldComponentUpdate to return false if final
|
||||
// props have not changed. If false, the selector will always return a new
|
||||
// object and shouldComponentUpdate will always return true.
|
||||
|
||||
|
||||
function finalPropsSelectorFactory(dispatch, _ref2) {
|
||||
var initMapStateToProps = _ref2.initMapStateToProps,
|
||||
initMapDispatchToProps = _ref2.initMapDispatchToProps,
|
||||
initMergeProps = _ref2.initMergeProps,
|
||||
options = (0, _objectWithoutPropertiesLoose2["default"])(_ref2, ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"]);
|
||||
var mapStateToProps = initMapStateToProps(dispatch, options);
|
||||
var mapDispatchToProps = initMapDispatchToProps(dispatch, options);
|
||||
var mergeProps = initMergeProps(dispatch, options);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
(0, _verifySubselectors["default"])(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName);
|
||||
}
|
||||
|
||||
var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory;
|
||||
return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
|
||||
}
|
||||
24
node_modules/react-redux/lib/connect/verifySubselectors.js
generated
vendored
Normal file
24
node_modules/react-redux/lib/connect/verifySubselectors.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = verifySubselectors;
|
||||
|
||||
var _warning = _interopRequireDefault(require("../utils/warning"));
|
||||
|
||||
function verify(selector, methodName, displayName) {
|
||||
if (!selector) {
|
||||
throw new Error("Unexpected value for " + methodName + " in " + displayName + ".");
|
||||
} else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') {
|
||||
if (!selector.hasOwnProperty('dependsOnOwnProps')) {
|
||||
(0, _warning["default"])("The selector for " + methodName + " of " + displayName + " did not specify a value for dependsOnOwnProps.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) {
|
||||
verify(mapStateToProps, 'mapStateToProps', displayName);
|
||||
verify(mapDispatchToProps, 'mapDispatchToProps', displayName);
|
||||
verify(mergeProps, 'mergeProps', displayName);
|
||||
}
|
||||
76
node_modules/react-redux/lib/connect/wrapMapToProps.js
generated
vendored
Normal file
76
node_modules/react-redux/lib/connect/wrapMapToProps.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.wrapMapToPropsConstant = wrapMapToPropsConstant;
|
||||
exports.getDependsOnOwnProps = getDependsOnOwnProps;
|
||||
exports.wrapMapToPropsFunc = wrapMapToPropsFunc;
|
||||
|
||||
var _verifyPlainObject = _interopRequireDefault(require("../utils/verifyPlainObject"));
|
||||
|
||||
function wrapMapToPropsConstant(getConstant) {
|
||||
return function initConstantSelector(dispatch, options) {
|
||||
var constant = getConstant(dispatch, options);
|
||||
|
||||
function constantSelector() {
|
||||
return constant;
|
||||
}
|
||||
|
||||
constantSelector.dependsOnOwnProps = false;
|
||||
return constantSelector;
|
||||
};
|
||||
} // dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args
|
||||
// to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine
|
||||
// whether mapToProps needs to be invoked when props have changed.
|
||||
//
|
||||
// A length of one signals that mapToProps does not depend on props from the parent component.
|
||||
// A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and
|
||||
// therefore not reporting its length accurately..
|
||||
|
||||
|
||||
function getDependsOnOwnProps(mapToProps) {
|
||||
return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1;
|
||||
} // Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction,
|
||||
// this function wraps mapToProps in a proxy function which does several things:
|
||||
//
|
||||
// * Detects whether the mapToProps function being called depends on props, which
|
||||
// is used by selectorFactory to decide if it should reinvoke on props changes.
|
||||
//
|
||||
// * On first call, handles mapToProps if returns another function, and treats that
|
||||
// new function as the true mapToProps for subsequent calls.
|
||||
//
|
||||
// * On first call, verifies the first result is a plain object, in order to warn
|
||||
// the developer that their mapToProps function is not returning a valid result.
|
||||
//
|
||||
|
||||
|
||||
function wrapMapToPropsFunc(mapToProps, methodName) {
|
||||
return function initProxySelector(dispatch, _ref) {
|
||||
var displayName = _ref.displayName;
|
||||
|
||||
var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) {
|
||||
return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch);
|
||||
}; // allow detectFactoryAndVerify to get ownProps
|
||||
|
||||
|
||||
proxy.dependsOnOwnProps = true;
|
||||
|
||||
proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
|
||||
proxy.mapToProps = mapToProps;
|
||||
proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
|
||||
var props = proxy(stateOrDispatch, ownProps);
|
||||
|
||||
if (typeof props === 'function') {
|
||||
proxy.mapToProps = props;
|
||||
proxy.dependsOnOwnProps = getDependsOnOwnProps(props);
|
||||
props = proxy(stateOrDispatch, ownProps);
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') (0, _verifyPlainObject["default"])(props, displayName, methodName);
|
||||
return props;
|
||||
};
|
||||
|
||||
return proxy;
|
||||
};
|
||||
}
|
||||
34
node_modules/react-redux/lib/hooks/useDispatch.js
generated
vendored
Normal file
34
node_modules/react-redux/lib/hooks/useDispatch.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.useDispatch = useDispatch;
|
||||
|
||||
var _useStore = require("./useStore");
|
||||
|
||||
/**
|
||||
* A hook to access the redux `dispatch` function. Note that in most cases where you
|
||||
* might want to use this hook it is recommended to use `useActions` instead to bind
|
||||
* action creators to the `dispatch` function.
|
||||
*
|
||||
* @returns {any|function} redux store's `dispatch` function
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* import React, { useCallback } from 'react'
|
||||
* import { useReduxDispatch } from 'react-redux'
|
||||
*
|
||||
* export const CounterComponent = ({ value }) => {
|
||||
* const dispatch = useDispatch()
|
||||
* const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
|
||||
* return (
|
||||
* <div>
|
||||
* <span>{value}</span>
|
||||
* <button onClick={increaseCounter}>Increase counter</button>
|
||||
* </div>
|
||||
* )
|
||||
* }
|
||||
*/
|
||||
function useDispatch() {
|
||||
var store = (0, _useStore.useStore)();
|
||||
return store.dispatch;
|
||||
}
|
||||
34
node_modules/react-redux/lib/hooks/useReduxContext.js
generated
vendored
Normal file
34
node_modules/react-redux/lib/hooks/useReduxContext.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.useReduxContext = useReduxContext;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _invariant = _interopRequireDefault(require("invariant"));
|
||||
|
||||
var _Context = require("../components/Context");
|
||||
|
||||
/**
|
||||
* A hook to access the value of the `ReactReduxContext`. This is a low-level
|
||||
* hook that you should usually not need to call directly.
|
||||
*
|
||||
* @returns {any} the value of the `ReactReduxContext`
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* import React from 'react'
|
||||
* import { useReduxContext } from 'react-redux'
|
||||
*
|
||||
* export const CounterComponent = ({ value }) => {
|
||||
* const { store } = useReduxContext()
|
||||
* return <div>{store.getState()}</div>
|
||||
* }
|
||||
*/
|
||||
function useReduxContext() {
|
||||
var contextValue = (0, _react.useContext)(_Context.ReactReduxContext);
|
||||
(0, _invariant["default"])(contextValue, 'could not find react-redux context value; please ensure the component is wrapped in a <Provider>');
|
||||
return contextValue;
|
||||
}
|
||||
128
node_modules/react-redux/lib/hooks/useSelector.js
generated
vendored
Normal file
128
node_modules/react-redux/lib/hooks/useSelector.js
generated
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.useSelector = useSelector;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
var _invariant = _interopRequireDefault(require("invariant"));
|
||||
|
||||
var _useReduxContext2 = require("./useReduxContext");
|
||||
|
||||
var _Subscription = _interopRequireDefault(require("../utils/Subscription"));
|
||||
|
||||
// React currently throws a warning when using useLayoutEffect on the server.
|
||||
// To get around it, we can conditionally useEffect on the server (no-op) and
|
||||
// useLayoutEffect in the browser. We need useLayoutEffect to ensure the store
|
||||
// subscription callback always has the selector from the latest render commit
|
||||
// available, otherwise a store update may happen between render and the effect,
|
||||
// which may cause missed updates; we also must ensure the store subscription
|
||||
// is created synchronously, otherwise a store update may occur before the
|
||||
// subscription is created and an inconsistent state may be observed
|
||||
var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? _react.useLayoutEffect : _react.useEffect;
|
||||
|
||||
var refEquality = function refEquality(a, b) {
|
||||
return a === b;
|
||||
};
|
||||
/**
|
||||
* A hook to access the redux store's state. This hook takes a selector function
|
||||
* as an argument. The selector is called with the store state.
|
||||
*
|
||||
* This hook takes an optional equality comparison function as the second parameter
|
||||
* that allows you to customize the way the selected state is compared to determine
|
||||
* whether the component needs to be re-rendered.
|
||||
*
|
||||
* @param {Function} selector the selector function
|
||||
* @param {Function=} equalityFn the function that will be used to determine equality
|
||||
*
|
||||
* @returns {any} the selected state
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* import React from 'react'
|
||||
* import { useSelector } from 'react-redux'
|
||||
*
|
||||
* export const CounterComponent = () => {
|
||||
* const counter = useSelector(state => state.counter)
|
||||
* return <div>{counter}</div>
|
||||
* }
|
||||
*/
|
||||
|
||||
|
||||
function useSelector(selector, equalityFn) {
|
||||
if (equalityFn === void 0) {
|
||||
equalityFn = refEquality;
|
||||
}
|
||||
|
||||
(0, _invariant["default"])(selector, "You must pass a selector to useSelectors");
|
||||
|
||||
var _useReduxContext = (0, _useReduxContext2.useReduxContext)(),
|
||||
store = _useReduxContext.store,
|
||||
contextSub = _useReduxContext.subscription;
|
||||
|
||||
var _useReducer = (0, _react.useReducer)(function (s) {
|
||||
return s + 1;
|
||||
}, 0),
|
||||
forceRender = _useReducer[1];
|
||||
|
||||
var subscription = (0, _react.useMemo)(function () {
|
||||
return new _Subscription["default"](store, contextSub);
|
||||
}, [store, contextSub]);
|
||||
var latestSubscriptionCallbackError = (0, _react.useRef)();
|
||||
var latestSelector = (0, _react.useRef)();
|
||||
var latestSelectedState = (0, _react.useRef)();
|
||||
var selectedState;
|
||||
|
||||
try {
|
||||
if (selector !== latestSelector.current || latestSubscriptionCallbackError.current) {
|
||||
selectedState = selector(store.getState());
|
||||
} else {
|
||||
selectedState = latestSelectedState.current;
|
||||
}
|
||||
} catch (err) {
|
||||
var errorMessage = "An error occured while selecting the store state: " + err.message + ".";
|
||||
|
||||
if (latestSubscriptionCallbackError.current) {
|
||||
errorMessage += "\nThe error may be correlated with this previous error:\n" + latestSubscriptionCallbackError.current.stack + "\n\nOriginal stack trace:";
|
||||
}
|
||||
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
|
||||
useIsomorphicLayoutEffect(function () {
|
||||
latestSelector.current = selector;
|
||||
latestSelectedState.current = selectedState;
|
||||
latestSubscriptionCallbackError.current = undefined;
|
||||
});
|
||||
useIsomorphicLayoutEffect(function () {
|
||||
function checkForUpdates() {
|
||||
try {
|
||||
var newSelectedState = latestSelector.current(store.getState());
|
||||
|
||||
if (equalityFn(newSelectedState, latestSelectedState.current)) {
|
||||
return;
|
||||
}
|
||||
|
||||
latestSelectedState.current = newSelectedState;
|
||||
} catch (err) {
|
||||
// we ignore all errors here, since when the component
|
||||
// is re-rendered, the selectors are called again, and
|
||||
// will throw again, if neither props nor store state
|
||||
// changed
|
||||
latestSubscriptionCallbackError.current = err;
|
||||
}
|
||||
|
||||
forceRender({});
|
||||
}
|
||||
|
||||
subscription.onStateChange = checkForUpdates;
|
||||
subscription.trySubscribe();
|
||||
checkForUpdates();
|
||||
return function () {
|
||||
return subscription.tryUnsubscribe();
|
||||
};
|
||||
}, [store, subscription]);
|
||||
return selectedState;
|
||||
}
|
||||
28
node_modules/react-redux/lib/hooks/useStore.js
generated
vendored
Normal file
28
node_modules/react-redux/lib/hooks/useStore.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.useStore = useStore;
|
||||
|
||||
var _useReduxContext2 = require("./useReduxContext");
|
||||
|
||||
/**
|
||||
* A hook to access the redux store.
|
||||
*
|
||||
* @returns {any} the redux store
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* import React from 'react'
|
||||
* import { useStore } from 'react-redux'
|
||||
*
|
||||
* export const ExampleComponent = () => {
|
||||
* const store = useStore()
|
||||
* return <div>{store.getState()}</div>
|
||||
* }
|
||||
*/
|
||||
function useStore() {
|
||||
var _useReduxContext = (0, _useReduxContext2.useReduxContext)(),
|
||||
store = _useReduxContext.store;
|
||||
|
||||
return store;
|
||||
}
|
||||
44
node_modules/react-redux/lib/index.js
generated
vendored
Normal file
44
node_modules/react-redux/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _Provider = _interopRequireDefault(require("./components/Provider"));
|
||||
|
||||
exports.Provider = _Provider["default"];
|
||||
|
||||
var _connectAdvanced = _interopRequireDefault(require("./components/connectAdvanced"));
|
||||
|
||||
exports.connectAdvanced = _connectAdvanced["default"];
|
||||
|
||||
var _Context = require("./components/Context");
|
||||
|
||||
exports.ReactReduxContext = _Context.ReactReduxContext;
|
||||
|
||||
var _connect = _interopRequireDefault(require("./connect/connect"));
|
||||
|
||||
exports.connect = _connect["default"];
|
||||
|
||||
var _useDispatch = require("./hooks/useDispatch");
|
||||
|
||||
exports.useDispatch = _useDispatch.useDispatch;
|
||||
|
||||
var _useSelector = require("./hooks/useSelector");
|
||||
|
||||
exports.useSelector = _useSelector.useSelector;
|
||||
|
||||
var _useStore = require("./hooks/useStore");
|
||||
|
||||
exports.useStore = _useStore.useStore;
|
||||
|
||||
var _batch = require("./utils/batch");
|
||||
|
||||
var _reactBatchedUpdates = require("./utils/reactBatchedUpdates");
|
||||
|
||||
exports.batch = _reactBatchedUpdates.unstable_batchedUpdates;
|
||||
|
||||
var _shallowEqual = _interopRequireDefault(require("./utils/shallowEqual"));
|
||||
|
||||
exports.shallowEqual = _shallowEqual["default"];
|
||||
(0, _batch.setBatch)(_reactBatchedUpdates.unstable_batchedUpdates);
|
||||
103
node_modules/react-redux/lib/utils/Subscription.js
generated
vendored
Normal file
103
node_modules/react-redux/lib/utils/Subscription.js
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _batch = require("./batch");
|
||||
|
||||
// encapsulates the subscription logic for connecting a component to the redux store, as
|
||||
// well as nesting subscriptions of descendant components, so that we can ensure the
|
||||
// ancestor components re-render before descendants
|
||||
var CLEARED = null;
|
||||
var nullListeners = {
|
||||
notify: function notify() {}
|
||||
};
|
||||
|
||||
function createListenerCollection() {
|
||||
var batch = (0, _batch.getBatch)(); // the current/next pattern is copied from redux's createStore code.
|
||||
// TODO: refactor+expose that code to be reusable here?
|
||||
|
||||
var current = [];
|
||||
var next = [];
|
||||
return {
|
||||
clear: function clear() {
|
||||
next = CLEARED;
|
||||
current = CLEARED;
|
||||
},
|
||||
notify: function notify() {
|
||||
var listeners = current = next;
|
||||
batch(function () {
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
listeners[i]();
|
||||
}
|
||||
});
|
||||
},
|
||||
get: function get() {
|
||||
return next;
|
||||
},
|
||||
subscribe: function subscribe(listener) {
|
||||
var isSubscribed = true;
|
||||
if (next === current) next = current.slice();
|
||||
next.push(listener);
|
||||
return function unsubscribe() {
|
||||
if (!isSubscribed || current === CLEARED) return;
|
||||
isSubscribed = false;
|
||||
if (next === current) next = current.slice();
|
||||
next.splice(next.indexOf(listener), 1);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var Subscription =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Subscription(store, parentSub) {
|
||||
this.store = store;
|
||||
this.parentSub = parentSub;
|
||||
this.unsubscribe = null;
|
||||
this.listeners = nullListeners;
|
||||
this.handleChangeWrapper = this.handleChangeWrapper.bind(this);
|
||||
}
|
||||
|
||||
var _proto = Subscription.prototype;
|
||||
|
||||
_proto.addNestedSub = function addNestedSub(listener) {
|
||||
this.trySubscribe();
|
||||
return this.listeners.subscribe(listener);
|
||||
};
|
||||
|
||||
_proto.notifyNestedSubs = function notifyNestedSubs() {
|
||||
this.listeners.notify();
|
||||
};
|
||||
|
||||
_proto.handleChangeWrapper = function handleChangeWrapper() {
|
||||
if (this.onStateChange) {
|
||||
this.onStateChange();
|
||||
}
|
||||
};
|
||||
|
||||
_proto.isSubscribed = function isSubscribed() {
|
||||
return Boolean(this.unsubscribe);
|
||||
};
|
||||
|
||||
_proto.trySubscribe = function trySubscribe() {
|
||||
if (!this.unsubscribe) {
|
||||
this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.handleChangeWrapper) : this.store.subscribe(this.handleChangeWrapper);
|
||||
this.listeners = createListenerCollection();
|
||||
}
|
||||
};
|
||||
|
||||
_proto.tryUnsubscribe = function tryUnsubscribe() {
|
||||
if (this.unsubscribe) {
|
||||
this.unsubscribe();
|
||||
this.unsubscribe = null;
|
||||
this.listeners.clear();
|
||||
this.listeners = nullListeners;
|
||||
}
|
||||
};
|
||||
|
||||
return Subscription;
|
||||
}();
|
||||
|
||||
exports["default"] = Subscription;
|
||||
24
node_modules/react-redux/lib/utils/batch.js
generated
vendored
Normal file
24
node_modules/react-redux/lib/utils/batch.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.getBatch = exports.setBatch = void 0;
|
||||
|
||||
// Default to a dummy "batch" implementation that just runs the callback
|
||||
function defaultNoopBatch(callback) {
|
||||
callback();
|
||||
}
|
||||
|
||||
var batch = defaultNoopBatch; // Allow injecting another batching function later
|
||||
|
||||
var setBatch = function setBatch(newBatch) {
|
||||
return batch = newBatch;
|
||||
}; // Supply a getter just to skip dealing with ESM bindings
|
||||
|
||||
|
||||
exports.setBatch = setBatch;
|
||||
|
||||
var getBatch = function getBatch() {
|
||||
return batch;
|
||||
};
|
||||
|
||||
exports.getBatch = getBatch;
|
||||
21
node_modules/react-redux/lib/utils/isPlainObject.js
generated
vendored
Normal file
21
node_modules/react-redux/lib/utils/isPlainObject.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = isPlainObject;
|
||||
|
||||
/**
|
||||
* @param {any} obj The object to inspect.
|
||||
* @returns {boolean} True if the argument appears to be a plain object.
|
||||
*/
|
||||
function isPlainObject(obj) {
|
||||
if (typeof obj !== 'object' || obj === null) return false;
|
||||
var proto = Object.getPrototypeOf(obj);
|
||||
if (proto === null) return true;
|
||||
var baseProto = proto;
|
||||
|
||||
while (Object.getPrototypeOf(baseProto) !== null) {
|
||||
baseProto = Object.getPrototypeOf(baseProto);
|
||||
}
|
||||
|
||||
return proto === baseProto;
|
||||
}
|
||||
8
node_modules/react-redux/lib/utils/reactBatchedUpdates.js
generated
vendored
Normal file
8
node_modules/react-redux/lib/utils/reactBatchedUpdates.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.unstable_batchedUpdates = void 0;
|
||||
|
||||
var _reactDom = require("react-dom");
|
||||
|
||||
exports.unstable_batchedUpdates = _reactDom.unstable_batchedUpdates;
|
||||
7
node_modules/react-redux/lib/utils/reactBatchedUpdates.native.js
generated
vendored
Normal file
7
node_modules/react-redux/lib/utils/reactBatchedUpdates.native.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _reactNative = require("react-native");
|
||||
|
||||
exports.unstable_batchedUpdates = _reactNative.unstable_batchedUpdates;
|
||||
33
node_modules/react-redux/lib/utils/shallowEqual.js
generated
vendored
Normal file
33
node_modules/react-redux/lib/utils/shallowEqual.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = shallowEqual;
|
||||
var hasOwn = Object.prototype.hasOwnProperty;
|
||||
|
||||
function is(x, y) {
|
||||
if (x === y) {
|
||||
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
||||
} else {
|
||||
return x !== x && y !== y;
|
||||
}
|
||||
}
|
||||
|
||||
function shallowEqual(objA, objB) {
|
||||
if (is(objA, objB)) return true;
|
||||
|
||||
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var keysA = Object.keys(objA);
|
||||
var keysB = Object.keys(objB);
|
||||
if (keysA.length !== keysB.length) return false;
|
||||
|
||||
for (var i = 0; i < keysA.length; i++) {
|
||||
if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
16
node_modules/react-redux/lib/utils/verifyPlainObject.js
generated
vendored
Normal file
16
node_modules/react-redux/lib/utils/verifyPlainObject.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = verifyPlainObject;
|
||||
|
||||
var _isPlainObject = _interopRequireDefault(require("./isPlainObject"));
|
||||
|
||||
var _warning = _interopRequireDefault(require("./warning"));
|
||||
|
||||
function verifyPlainObject(value, displayName, methodName) {
|
||||
if (!(0, _isPlainObject["default"])(value)) {
|
||||
(0, _warning["default"])(methodName + "() in " + displayName + " must return a plain object. Instead received " + value + ".");
|
||||
}
|
||||
}
|
||||
29
node_modules/react-redux/lib/utils/warning.js
generated
vendored
Normal file
29
node_modules/react-redux/lib/utils/warning.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = warning;
|
||||
|
||||
/**
|
||||
* Prints a warning in the console if it exists.
|
||||
*
|
||||
* @param {String} message The warning message.
|
||||
* @returns {void}
|
||||
*/
|
||||
function warning(message) {
|
||||
/* eslint-disable no-console */
|
||||
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
||||
console.error(message);
|
||||
}
|
||||
/* eslint-enable no-console */
|
||||
|
||||
|
||||
try {
|
||||
// This error was thrown as a convenience so that if you enable
|
||||
// "break on all exceptions" in your console,
|
||||
// it would pause the execution at this line.
|
||||
throw new Error(message);
|
||||
/* eslint-disable no-empty */
|
||||
} catch (e) {}
|
||||
/* eslint-enable no-empty */
|
||||
|
||||
}
|
||||
12
node_modules/react-redux/lib/utils/wrapActionCreators.js
generated
vendored
Normal file
12
node_modules/react-redux/lib/utils/wrapActionCreators.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = wrapActionCreators;
|
||||
|
||||
var _redux = require("redux");
|
||||
|
||||
function wrapActionCreators(actionCreators) {
|
||||
return function (dispatch) {
|
||||
return (0, _redux.bindActionCreators)(actionCreators, dispatch);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user