Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (state, ownProps) => {
const nextProps = props(state, ownProps)
if (shallowEqualObjects(prevProps, nextProps)) return prevResult
const nextResult = {...nextProps, ...functions(nextProps, dispatch)}
prevResult = nextResult
prevProps = nextProps
return nextResult
}
}, {
export const setPersistConfig = (persist: ReduxStoreConfig['persist']): void => {
if (config && shallowEqualObjects(config, persist)) {
return;
}
config = persist;
if (config) {
ready = false;
setStorage(config.storage);
whiteList = config.whitelist ? config.whitelist.map((item) => item.getReducerName()) : [];
blackList = config.blacklist ? config.blacklist.map((item) => item.getReducerName()) : [];
defaultPersistOption.__persist.version = config.version;
} else {
persistIsReady();
}
};
public componentDidUpdate(prevProps: Readonly, prevState: Readonly): void {
const {onSelectionChange} = this.props;
const {
rawFiles: oldRawFiles, selection: oldSelection, options: oldOptions,
sortProperty: oldSortProperty, sortOrder: oldSortOrder,
} = prevState;
const {rawFiles, selection, options, sortProperty, sortOrder} = this.state;
let justChangedSelection = false;
const needToResort = !shallowEqualArrays(rawFiles, oldRawFiles)
|| !shallowEqualObjects(options, oldOptions)
|| sortProperty !== oldSortProperty
|| sortOrder !== oldSortOrder;
if (needToResort) {
const [sortedFiles, fileIndexMap] = FileUtil.sortFiles(rawFiles, options, sortProperty, sortOrder);
const newState: Partial = {sortedFiles, fileIndexMap};
const newSelection = {};
let additionCount = 0;
for (const file of sortedFiles) {
if (isNil(file) || selection[file.id] !== true) continue;
newSelection[file.id] = true;
additionCount++;
}
if (additionCount !== Object.keys(selection).length) {
newState.selection = newSelection;
justChangedSelection = true;
context.classNamePrefix += classNamePrefix
}
if (media !== undefined) {
context.media = media
}
if (jss) {
context.jss = jss
}
if (disableStylesGeneration !== undefined) {
context.disableStylesGeneration = disableStylesGeneration
}
if (prevContext && shallowEqualObjects(prevContext, context)) {
return prevContext
}
return context
}