MCPcopy Create free account
hub / github.com/bytebase/bytebase / useCurrentUser

Function useCurrentUser

frontend/src/react/hooks/useAppState.ts:36–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34}
35
36export function useCurrentUser() {
37 const user = useOptionalCurrentUser();
38 // Stabilize the fallback identity: a fresh unknownUser() each render would
39 // change identity while the user is unresolved, retriggering identity-keyed
40 // effects in callers (e.g. ProfilePage, TwoFactorSetupPage) and risking a
41 // render loop.
42 return useMemo(() => user ?? unknownUser(), [user]);
43}
44
45export function useWorkspace() {
46 const workspace = useAppStore((state) => state.workspace);

Callers 15

PresetButtonsFunction · 0.90
AccountMultiSelectFunction · 0.90
CreateDatabaseSheetFunction · 0.90
InactiveRemindModalFunction · 0.90
useDropdownFunction · 0.90
SharePopoverBodyFunction · 0.90
ConnectionPaneInnerFunction · 0.90
ProfileSetupPageFunction · 0.90
PasswordResetPageFunction · 0.90
MyIssuesPageFunction · 0.90

Calls 2

unknownUserFunction · 0.90
useOptionalCurrentUserFunction · 0.85

Tested by

no test coverage detected