-
Notifications
You must be signed in to change notification settings - Fork 0
Description
This issue is referring to a task that aims at caching/memoizing computed values from static callback information.
It is the function getHostStorePropertyRefs() in actions/handleHostStoreChange.ts:
chartlets/chartlets.js/packages/lib/src/actions/handleHostStoreChange.ts
Lines 69 to 102 in d597c8e
| // TODO: use a memoized selector to get hostStorePropertyRefs | |
| // Note that this will only be effective and once we split the | |
| // static contribution infos and dynamic contribution states. | |
| // The hostStorePropertyRefs only depend on the static | |
| // contribution infos. | |
| /** | |
| * Get the static list of host state property references for all contributions. | |
| */ | |
| function getHostStorePropertyRefs(): PropertyRef[] { | |
| const { contributionsRecord } = store.getState(); | |
| const propertyRefs: PropertyRef[] = []; | |
| Object.getOwnPropertyNames(contributionsRecord).forEach((contribPoint) => { | |
| const contributions = contributionsRecord[contribPoint]; | |
| contributions.forEach((contribution, contribIndex) => { | |
| (contribution.callbacks || []).forEach( | |
| (callback, callbackIndex) => | |
| (callback.inputs || []).forEach((input, inputIndex) => { | |
| if (!input.noTrigger && input.id === "@app" && input.property) { | |
| propertyRefs.push({ | |
| contribPoint, | |
| contribIndex, | |
| callbackIndex, | |
| inputIndex, | |
| property: formatObjPath(input.property), | |
| }); | |
| } | |
| }), | |
| [] as Input[], | |
| ); | |
| }); | |
| }); | |
| return propertyRefs; | |
| } |