Skip to content

Commit d45bfc2

Browse files
committed
no longer memoizing
1 parent 0edcecf commit d45bfc2

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

dashi/src/lib/actions/handleHostStoreChange.ts

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import memoizeOne from "memoize-one";
2-
31
import { store } from "@/lib/store";
42
import type {
53
CallbackRef,
@@ -39,30 +37,29 @@ function getCallbackRequests<S extends object = object>(
3937
hostState: S,
4038
prevHostState: S,
4139
): CallbackRequest[] {
42-
const propertyRefs = getHostStorePropertyRefs().filter((propertyRef) =>
43-
hasPropertyChanged(propertyRef.propertyPath, hostState, prevHostState),
44-
);
45-
const callbackRequest: CallbackRequest[] = [];
46-
propertyRefs.forEach((propertyRef) => {
47-
const contributions = contributionsRecord[propertyRef.contribPoint];
48-
const contribution = contributions[propertyRef.contribIndex];
49-
const callback = contribution.callbacks![propertyRef.callbackIndex];
50-
const inputValues = getInputValues(
51-
callback.inputs!,
52-
contribution,
53-
hostState,
54-
);
55-
callbackRequest.push({ ...propertyRef, inputValues });
56-
});
57-
return callbackRequest;
40+
return getHostStorePropertyRefs()
41+
.filter((propertyRef) =>
42+
hasPropertyChanged(propertyRef.propertyPath, hostState, prevHostState),
43+
)
44+
.map((propertyRef) => {
45+
const contributions = contributionsRecord[propertyRef.contribPoint];
46+
const contribution = contributions[propertyRef.contribIndex];
47+
const callback = contribution.callbacks![propertyRef.callbackIndex];
48+
const inputValues = getInputValues(
49+
callback.inputs!,
50+
contribution,
51+
hostState,
52+
);
53+
return { ...propertyRef, inputValues };
54+
});
5855
}
5956

60-
const getHostStorePropertyRefs = memoizeOne(_getHostStorePropertyRefs);
57+
// const getHostStorePropertyRefs = memoizeOne(_getHostStorePropertyRefs);
6158

6259
/**
6360
* Get the static list of host state property references for all contributions.
6461
*/
65-
function _getHostStorePropertyRefs(): PropertyRef[] {
62+
function getHostStorePropertyRefs(): PropertyRef[] {
6663
const { contributionsRecord } = store.getState();
6764
const propertyRefs: PropertyRef[] = [];
6865
Object.getOwnPropertyNames(contributionsRecord).forEach((contribPoint) => {

0 commit comments

Comments
 (0)