Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Fix hook count error

Gabe Kangasa22b7e9cfacd
diff --git a/web/components/common/UserDropdown/UserDropdown.tsx b/web/components/common/UserDropdown/UserDropdown.tsx
index 62357fbdf5..44b8688f65 100644
--- a/web/components/common/UserDropdown/UserDropdown.tsx
+++ b/web/components/common/UserDropdown/UserDropdown.tsx
@@ -39,14 +39,6 @@ export const UserDropdown: FC<UserDropdownProps> = ({ username: defaultUsername
const [chatToggleVisible, setChatToggleVisible] = useRecoilState(chatVisibleToggleAtom);
const appState = useRecoilValue<AppStateOptions>(appStateAtom);
- const currentUser = useRecoilValue(currentUserAtom);
- if (!currentUser) {
- return null;
- }
-
- const { displayName } = currentUser;
- const username = defaultUsername || displayName;
-
const toggleChatVisibility = () => {
setChatToggleVisible(!chatToggleVisible);
};
@@ -65,6 +57,13 @@ export const UserDropdown: FC<UserDropdownProps> = ({ username: defaultUsername
[chatToggleVisible],
);
+ const currentUser = useRecoilValue(currentUserAtom);
+ if (!currentUser) {
+ return null;
+ }
+
+ const { displayName } = currentUser;
+ const username = defaultUsername || displayName;
const menu = (
<Menu>
<Menu.Item key="0" icon={<EditOutlined />} onClick={() => handleChangeName()}>