Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

feat(core): add memoization to style generation #888

Merged
merged 3 commits into from
Nov 29, 2018

Conversation

CaerusKaru
Copy link
Member

Fixes #887

@CaerusKaru
Copy link
Member Author

NOTE: A follow-up will be needed to cache the values for builders that run adjacent to other tasks

@CaerusKaru
Copy link
Member Author

Ok so the follow-up was a little hasty. The layout issue was resolved plainly and easily by adding a sideEffect parameter to addStyles. Basically it allows you to get the computed styles and perform an operation with them after the styles have been added (the logic being that if you need to change style generation itself, it should be done in the builder).

For gap, the story is different because it depends a lot on the directionality of the given moment. So, while caching is done in grid mode, it's not really possible at any other point. Although this is not ideal, it's an unfortunate reality.

@CaerusKaru
Copy link
Member Author

Conceptually this raises issues with fxLayoutGap because it doesn't actually leave much room for the StyleBuilder to be independent. A closer look will have to be taken at that particular directive.

@CaerusKaru
Copy link
Member Author

Ok fixed that too because now the sideEffects are part of the StyleBuilders. That way there's a clear-cut path for the chain of events: StyleBuilder.buildStyles -> StyleBuilder.sideEffect. This way the buildStyles values can be cached if necessary, and the sideEffect computation can happen regardless.

@ThomasBurleson ThomasBurleson merged commit 4600672 into master Nov 29, 2018
@ThomasBurleson ThomasBurleson deleted the adam/fix-issue-887 branch November 29, 2018 23:54
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(core): add memoization for all style generation
3 participants