Skip to content

Cache static callback information retrieved from API #113

@forman

Description

@forman

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:

// 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;
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions