Replies: 1 comment
-
It's not clear what does it mean "new unread messages". |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Its more a question of JS variable scoping & binding than swr but still related.
The server has an endpoint that returns all the unread messages (for all channels).
So every minute or so the enpoint is polled and if new messages have arrived the hook should return the newly arrived unread messages.
I could setup 2 hooks, one fetching all the pending unread messages and a dependent hook that takes those messages and compares it to the previous ones. But I wonder if I could handle it in one hook instead (since the messages themselves are not that important, only that there are new messages).
The client is supposed to show a toast when new messages arrive.
In the snipped below, is it safe to access
data
Beta Was this translation helpful? Give feedback.
All reactions