The user a profile page is about comes through this hook, which loads them by the name in the URL and keeps them live. Each tab of the profile loads its own lists, by the user's id.
f
useProfile(username: string | undefined): UseProfileResult
Returns the user named username, from GET /api/users/@:username, which
answers a former name or another case too. The profile then puts the
current name in its URL, and that path, naming the user on screen, fetches
nothing; another user's does. The socket's user_updated keeps them live,
and a reconnection fetches them again.
I
UseProfileResult
Returned by useProfile to UserPublicProfile.
-
isOwnProfile: boolean
It is false while the profile loads.
-
setUser: (fn: (user: PublicUser) => PublicUser) => void
It shows the header's edits, which the server echoes to other browsers.
- state: FetchState<PublicUser>
Usage
import * as mod from "src/hooks/profile/useProfile.ts";