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
Removing memoisation from context #1312
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit e48a15c:
|
|
||
describe("animate prop as variant", () => { | ||
// // @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, oops. What caused this?
variantLabelsAsDependency(animate), | ||
] | ||
: [] | ||
[variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the useMemo needed at all if we break it?
And shall we add a comment as to why we intentionally break the memoization in some cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel like it's necessary. We only generate a new context object when its contents change, it feels like a relatively straightforward use of memoisation.
/** | ||
* In a future refactor we can replace the features-as-components and | ||
* have this loop through them all firing "effect" listeners | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment no longer relevant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it was something I thought was a nice idea at the time but don't now.
Removing context memoisation ensures values removed from
Fixes https://github.com/framer/company/issues/23061