organify-ui 0.3.26 → 0.3.28

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.
@@ -2949,6 +2949,7 @@ function useChat(options = {}) {
2949
2949
  }, [userId, user, options.workspaceMembers]);
2950
2950
  const fetchRooms = useCallback(async () => {
2951
2951
  if (initialRooms && initialRooms.length > 0) return;
2952
+ if (!workspaceId || workspaceId.startsWith("temp-")) return;
2952
2953
  if (!userId) return;
2953
2954
  setLoadingRooms(true);
2954
2955
  setError(null);
@@ -2974,40 +2975,6 @@ function useChat(options = {}) {
2974
2975
  setLoadingRooms(false);
2975
2976
  }
2976
2977
  }, [workspaceId, userId, gql, initialRooms]);
2977
- const resolveUnknownUsers = useCallback(async (msgs) => {
2978
- const unknownIds = [...new Set(msgs.map((m) => m.authorId).filter((id) => !userCache.has(id)))];
2979
- if (unknownIds.length === 0 || !workspaceId || workspaceId.startsWith("temp-")) return;
2980
- try {
2981
- const data = await centralGql(
2982
- "workspaces",
2983
- `query($slug: String!) {
2984
- workspace(slug: $slug) {
2985
- members {
2986
- userId
2987
- user { id name email avatar }
2988
- }
2989
- }
2990
- }`,
2991
- { slug: workspaceId }
2992
- // Hack: Assuming workspaceId is the slug for this query, ideally we'd query users directly if there was an endpoint, but this refreshes workspace members
2993
- );
2994
- const newMembers = data?.workspace?.members || [];
2995
- setUserCache((prev) => {
2996
- const next = new Map(prev);
2997
- for (const member of newMembers) {
2998
- if (member.user?.id && !next.has(member.user.id)) {
2999
- next.set(member.user.id, {
3000
- displayName: member.user.name || member.user.email || `User`,
3001
- avatarUrl: member.user.avatar ?? void 0
3002
- });
3003
- }
3004
- }
3005
- return next;
3006
- });
3007
- } catch (e) {
3008
- console.warn("[organify-chat] resolveUnknownUsers failed:", e);
3009
- }
3010
- }, [userCache, workspaceId, centralGql]);
3011
2978
  const MESSAGE_FIELDS = `
3012
2979
  id roomId authorId parentId
3013
2980
  content edited editedAt createdAt
@@ -3036,11 +3003,9 @@ function useChat(options = {}) {
3036
3003
  }`,
3037
3004
  { roomId, filter: { limit: 50 } }
3038
3005
  );
3039
- const fetchedMessages = data.messages?.items ?? [];
3040
- setMessages(fetchedMessages);
3006
+ setMessages(data.messages?.items ?? []);
3041
3007
  setHasMoreMessages(data.messages?.hasMore ?? false);
3042
3008
  setMessageCursor(data.messages?.nextCursor ?? null);
3043
- resolveUnknownUsers(fetchedMessages);
3044
3009
  } catch (err) {
3045
3010
  console.error("[organify-chat] fetchMessages:", err);
3046
3011
  setError("Erro ao carregar mensagens.");
@@ -3068,7 +3033,6 @@ function useChat(options = {}) {
3068
3033
  setMessages((prev) => [...olderMessages, ...prev]);
3069
3034
  setHasMoreMessages(data.messages?.hasMore ?? false);
3070
3035
  setMessageCursor(data.messages?.nextCursor ?? null);
3071
- resolveUnknownUsers(olderMessages);
3072
3036
  } catch (err) {
3073
3037
  console.error("[organify-chat] loadMore:", err);
3074
3038
  } finally {
@@ -4744,5 +4708,5 @@ function useAiInline({ gatewayUrl, workspaceId, projectId }) {
4744
4708
  }
4745
4709
 
4746
4710
  export { AiChatSidebar, Alert, Button, ChatMessages, ChatSidebar, CommandBar, CreateRoomDialog, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, InlineAiButton, Input, Label, MOCK_PROJECTS, MOCK_USERS, MentionPopover, MessageBubble, MessageInput, OrgLoader, OrgLoaderInline, OrganifyChat, ResponsiveDialog, RoomManagementPanel, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, TypingIndicatorMock, UserAvatar, UserDisplayName, alertVariants, buttonVariants, generateAutoReplies, getMockMentionOptions, getRoomPermissions, inputVariants, invalidateUserCache, orgLoaderVariants, resolveUser, seedUserCache, typingIndicator, useAiInline, useChat, useResolvedUser };
4747
- //# sourceMappingURL=chunk-AV6TZPXE.js.map
4748
- //# sourceMappingURL=chunk-AV6TZPXE.js.map
4711
+ //# sourceMappingURL=chunk-JIT64DWO.js.map
4712
+ //# sourceMappingURL=chunk-JIT64DWO.js.map