-
Notifications
You must be signed in to change notification settings - Fork 21
Cache matching endpoints in context #565
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
bitterpanda63
left a comment
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.
🚀
| } | ||
| const endpoints = matchEndpoints(context, this.nonGraphQLEndpoints); | ||
| // Cache the endpoints to avoid re-running the matchEndpoints function | ||
| updateContext(context, "cachedMatchingEndpoints", endpoints); |
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.
Function modifies input parameter 'context' by caching endpoints, creating unexpected side effects. More info
|
|
||
| getEndpoints(context: LimitedContext) { | ||
| return matchEndpoints(context, this.nonGraphQLEndpoints); | ||
| getEndpoints(context: Context): Endpoint[] { |
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.
Function mixes endpoint matching logic with caching infrastructure concerns. More info
| context.cache.delete(key); | ||
| } | ||
|
|
||
| // Delete cacheMatchingEndpoints if method, url, or route changes |
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.
Comment restates obvious code mechanics without explaining why cache invalidation is needed. More info
No description provided.