|
1 | | -import memoizeOne from "memoize-one"; |
2 | | - |
3 | 1 | import { store } from "@/lib/store"; |
4 | 2 | import type { |
5 | 3 | CallbackRef, |
@@ -39,30 +37,29 @@ function getCallbackRequests<S extends object = object>( |
39 | 37 | hostState: S, |
40 | 38 | prevHostState: S, |
41 | 39 | ): 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 | + }); |
58 | 55 | } |
59 | 56 |
|
60 | | -const getHostStorePropertyRefs = memoizeOne(_getHostStorePropertyRefs); |
| 57 | +// const getHostStorePropertyRefs = memoizeOne(_getHostStorePropertyRefs); |
61 | 58 |
|
62 | 59 | /** |
63 | 60 | * Get the static list of host state property references for all contributions. |
64 | 61 | */ |
65 | | -function _getHostStorePropertyRefs(): PropertyRef[] { |
| 62 | +function getHostStorePropertyRefs(): PropertyRef[] { |
66 | 63 | const { contributionsRecord } = store.getState(); |
67 | 64 | const propertyRefs: PropertyRef[] = []; |
68 | 65 | Object.getOwnPropertyNames(contributionsRecord).forEach((contribPoint) => { |
|
0 commit comments