@djangocfg/layouts 2.1.21 → 2.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/layouts",
3
- "version": "2.1.21",
3
+ "version": "2.1.22",
4
4
  "description": "Simple, straightforward layout components for Next.js - import and use with props",
5
5
  "keywords": [
6
6
  "layouts",
@@ -92,9 +92,9 @@
92
92
  "check": "tsc --noEmit"
93
93
  },
94
94
  "peerDependencies": {
95
- "@djangocfg/api": "^2.1.21",
96
- "@djangocfg/centrifugo": "^2.1.21",
97
- "@djangocfg/ui-nextjs": "^2.1.21",
95
+ "@djangocfg/api": "^2.1.22",
96
+ "@djangocfg/centrifugo": "^2.1.22",
97
+ "@djangocfg/ui-nextjs": "^2.1.22",
98
98
  "@hookform/resolvers": "^5.2.0",
99
99
  "consola": "^3.4.2",
100
100
  "lucide-react": "^0.545.0",
@@ -114,7 +114,7 @@
114
114
  "uuid": "^11.1.0"
115
115
  },
116
116
  "devDependencies": {
117
- "@djangocfg/typescript-config": "^2.1.21",
117
+ "@djangocfg/typescript-config": "^2.1.22",
118
118
  "@types/node": "^24.7.2",
119
119
  "@types/react": "^19.1.0",
120
120
  "@types/react-dom": "^19.1.0",
@@ -76,11 +76,8 @@ export function UserMenu({
76
76
  setMounted(true);
77
77
  }, []);
78
78
 
79
- if (!mounted) {
80
- return null;
81
- }
82
-
83
79
  // Prepare menu groups (new groups prop or fallback to legacy props)
80
+ // Must be before early return to maintain hook order
84
81
  const menuGroups: UserMenuGroup[] = React.useMemo(() => {
85
82
  if (groups && groups.length > 0) {
86
83
  return groups;
@@ -115,6 +112,10 @@ export function UserMenu({
115
112
  return legacyGroups;
116
113
  }, [groups, profilePath, logout]);
117
114
 
115
+ if (!mounted) {
116
+ return null;
117
+ }
118
+
118
119
  if (!isAuthenticated || !user) {
119
120
  // Guest user - show sign in button
120
121
  if (variant === 'mobile') {
@@ -93,12 +93,21 @@ export const ChatMessages = forwardRef<ChatMessagesHandle, ChatMessagesProps>(
93
93
  // Initial scroll when history loads (instant, no animation)
94
94
  useEffect(() => {
95
95
  if (!isLoading && messages.length > 0 && !hasScrolledOnLoad.current) {
96
+ // Double RAF to ensure DOM is fully updated
96
97
  requestAnimationFrame(() => {
97
- scrollToLastMessage(true);
98
- hasScrolledOnLoad.current = true;
98
+ requestAnimationFrame(() => {
99
+ // Verify messages are actually in DOM before scrolling
100
+ if (messagesContainerRef.current) {
101
+ const messageElements = messagesContainerRef.current.querySelectorAll('[data-message-bubble]');
102
+ if (messageElements.length === messages.length) {
103
+ scrollToLastMessage(true);
104
+ hasScrolledOnLoad.current = true;
105
+ }
106
+ }
107
+ });
99
108
  });
100
109
  }
101
- }, [isLoading, messages.length, scrollToLastMessage]);
110
+ }, [isLoading, messages.length, scrollToLastMessage, messages]);
102
111
 
103
112
  // Scroll to last message on new messages (smooth animation, shows top of message)
104
113
  useEffect(() => {