Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to cache composable results #736

Merged
merged 1 commit into from
Feb 13, 2023
Merged

Conversation

matthew-white
Copy link
Member

This PR is a precursor to #676.

Comment on lines -27 to +33
export default () => {
const { i18n } = inject('container');
return {
// Returns a message describing an audit action.
actionMessage: (action) => {
const path = actionPath(action);
return i18n.te(path, i18n.fallbackLocale) ? i18n.t(path) : null;
}
};
};
export default memoizeForContainer(({ i18n }) => ({
// Returns a message describing an audit action.
actionMessage: (action) => {
const path = actionPath(action);
return i18n.te(path, i18n.fallbackLocale) ? i18n.t(path) : null;
}
}));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today, each AuditRow component that uses the useAudit() composable ends up creating its own actionMessage() function. After this change, the same function will be returned to each component.

@matthew-white matthew-white merged commit c071405 into master Feb 13, 2023
@matthew-white matthew-white deleted the memoize-for-container branch February 13, 2023 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants