TeactN: Fix detaching, remove unused code
This commit is contained in:
parent
384e216e5f
commit
d64b6f2854
@ -54,7 +54,6 @@ const containers = new Map<string, {
|
|||||||
ownProps: Props;
|
ownProps: Props;
|
||||||
mappedProps?: Props;
|
mappedProps?: Props;
|
||||||
forceUpdate: Function;
|
forceUpdate: Function;
|
||||||
areMappedPropsChanged: boolean;
|
|
||||||
isDetached: boolean;
|
isDetached: boolean;
|
||||||
detachReason: any;
|
detachReason: any;
|
||||||
detachWhenChanged: DetachWhenChanged;
|
detachWhenChanged: DetachWhenChanged;
|
||||||
@ -188,7 +187,6 @@ function updateContainers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
container.mappedProps = newMappedProps;
|
container.mappedProps = newMappedProps;
|
||||||
container.areMappedPropsChanged = true;
|
|
||||||
container.DEBUG_updates++;
|
container.DEBUG_updates++;
|
||||||
|
|
||||||
forceUpdate();
|
forceUpdate();
|
||||||
@ -248,7 +246,6 @@ export function withGlobal<OwnProps extends AnyLiteral>(
|
|||||||
container = {
|
container = {
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
ownProps: props,
|
ownProps: props,
|
||||||
areMappedPropsChanged: false,
|
|
||||||
forceUpdate,
|
forceUpdate,
|
||||||
isDetached: false,
|
isDetached: false,
|
||||||
detachReason: undefined,
|
detachReason: undefined,
|
||||||
@ -269,17 +266,15 @@ export function withGlobal<OwnProps extends AnyLiteral>(
|
|||||||
containers.set(id, container);
|
containers.set(id, container);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (container.areMappedPropsChanged) {
|
|
||||||
container.areMappedPropsChanged = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!container.mappedProps || !arePropsShallowEqual(container.ownProps, props)) {
|
if (!container.mappedProps || !arePropsShallowEqual(container.ownProps, props)) {
|
||||||
container.ownProps = props;
|
container.ownProps = props;
|
||||||
|
|
||||||
try {
|
if (!container.isDetached) {
|
||||||
container.mappedProps = mapStateToProps(currentGlobal, props, container.detachWhenChanged);
|
try {
|
||||||
} catch (err: any) {
|
container.mappedProps = mapStateToProps(currentGlobal, props, container.detachWhenChanged);
|
||||||
handleError(err);
|
} catch (err: any) {
|
||||||
|
handleError(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user