From f3a05f1abe35d690e433a8ad9b6f5a999a7da7fe Mon Sep 17 00:00:00 2001 From: Nick Partridge Date: Thu, 20 Feb 2020 22:44:33 -0600 Subject: [PATCH] fix: redux connect memo issue related to spec upserting (#563) --- src/state/spec_factory.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/state/spec_factory.ts b/src/state/spec_factory.ts index a27d9a2214..df15eb5601 100644 --- a/src/state/spec_factory.ts +++ b/src/state/spec_factory.ts @@ -51,5 +51,12 @@ const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ); export function getConnect() { - return connect(null, mapDispatchToProps); + /** + * Redux assumes shallowEqual for all connected components + * + * This causes an issue where the specs are cleared and memoized spec components will never be + * rerendered and thus never re-upserted to the state. Setting pure to false solves this issue + * and doesn't cause traditional performance degradations. + */ + return connect(null, mapDispatchToProps, null, { pure: false }); }