-
Notifications
You must be signed in to change notification settings - Fork 34
Dev 979 #1016
Conversation
…aching to reduce requests sent #979
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.
hi @wiadev, please check out my question regarding "cache invalidation"
src/actions/MenuActions.js
Outdated
@@ -3,6 +3,9 @@ import axios from 'axios'; | |||
|
|||
// REQUESTS | |||
|
|||
let breadcrumbsCache = {}; |
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.
question (mind that i'm a javascript-noob): how and when is this cache discarded or invalidated?
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.
we don't need to invalidate it. when you refresh the page, it gets cleared. when you 're navigating, it's not changed.
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.
@wiadev here is my input as yet another javascript-noob :)
Loud thinking: i think the frontend side shall not cache those results at all. It shall simply call the endpoint each time user is pressing on the breadcrumb item.
Reasons:
- we are already caching it on backend side and it would be quite difficult and error prone to invalidate all caches along the road, when a sysadm is changing the menu.
- when and if we would want to optimize that part and save some calls, we can do browser level caching (ETag, cache control etc), so basically, when the backend menu cache is invalidated we would send a different ETag.
wdyt?
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.
@teosarca Removed the cache.
All things you told above are correct and valid. But this particular piece simply didn't get updated that often. That's why I decided to reduce requests.
Now it removed and just don't fire duplicate requests sent for the same breadcrumb items.
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.
koszi :)
#979