Shows a user's new avatar everywhere as soon as they change it, without a
reload. WSProvider fills this context from user_updated messages, and
Avatar reads it.
I
AvatarOverride
Set by WSProvider for a user whose profile changed, and read by Avatar,
where it wins over the possibly stale props the page fetched.
- hasAvatar: boolean
-
version: number
The user's
updatedAtin ms, or the arrival time without one. It busts the cached image.
v
AvatarOverrideContext: React.Context<Record<string, AvatarOverride>>
Shows changed avatars without a reload, as an AvatarOverride by user
id. It is apart from WSContext, so the many avatars of a page don't
re-render on every vote or comment.
Usage
import * as mod from "src/contexts/ws/AvatarOverrideContext.ts";