-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix(js): Bypass cache during novu.notifications.list() #6690
Conversation
✅ Deploy Preview for novu-stg-vite-dashboard-poc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
return this.callWithSession(async () => { | ||
const args = { limit, ...restOptions }; | ||
try { | ||
let data: ListNotificationsResponse | undefined = this.#useCache ? this.cache.getAll(args) : undefined; | ||
let data: ListNotificationsResponse | undefined = | ||
this.#useCache || useCache ? this.cache.getAll(args) : undefined; |
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.
@SokratisVidros, if I have set useCache: true
in the options to the Novu
class, then this function option useCache
won't help with the override because the first part of or
will be satisfied. Only when the options on the Novu
class are use cache: false
it will control it.
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.
🤦 good catch.It should be the other way around.
c95c76c
to
8ac468f
Compare
Introduce novu.notifications.list({ useCache: false }) option to always fetch the latest notifications and bypass the cache.
8ac468f
to
9d9de09
Compare
commit: |
What changed? Why was the change needed?
Introduce
novu.notifications.list({ useCache: true | false })
option to always fetch the latest notifications and bypass the cache. This should give the ability to build an Inbox UI that auto-refreshes when a new notification is available.The
useCache
option of the list function defaults to true.