Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Streaming New Messages on Created Conversations #1336

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

alexrisch
Copy link
Collaborator

@alexrisch alexrisch commented Dec 10, 2024

Restart message stream when creating a new conversation Updated Accounts list to use query
Added pull to refresh for request list

Workaround for xmtp/xmtp-react-native#560

Fixes #1335
Fixes #1334

Summary by CodeRabbit

  • New Features

    • Enhanced data fetching capabilities in the conversation requests list.
    • Improved handling of account profiles by utilizing a preferred names hook.
    • Introduced message streaming management for new conversations and groups.
  • Bug Fixes

    • Addressed case sensitivity issues in account identifier handling.
  • Refactor

    • Simplified account data management in the Accounts component.
    • Streamlined the use of hooks for account profiles, reducing complexity.
  • Chores

    • Removed obsolete imports and code for better clarity and maintainability.

@alexrisch alexrisch requested a review from a team as a code owner December 10, 2024 03:57
Copy link

coderabbitai bot commented Dec 10, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request introduces several modifications across various components and utilities. The useRequestItems hook is enhanced to return additional properties, isRefetching and refetch, which are integrated into the ConversationRequestsListNav and Accounts components. The Accounts component now uses accountsProfiles directly instead of the useAccountsList hook. Additionally, the useAccountsProfiles function is simplified by relying on the usePreferredNames hook. Changes also include improvements to conversation management in the xmtpRN utilities, enhancing message streaming and account handling.

Changes

File Path Change Summary
features/conversation-requests-list/useRequestItems.tsx Updated useRequestItems to return isRefetching and refetch along with likelyNotSpam and likelySpam.
screens/Accounts/Accounts.tsx Removed useAccountsList hook; updated to use accountsProfiles directly for rendering account titles.
screens/Navigation/ConversationRequestsListNav.ios.tsx Integrated new properties isRefetching and refetch from useRequestItems into ConversationFlashList.
screens/Navigation/ConversationRequestsListNav.tsx Similar updates as above for ConversationFlashList to include isRefetching and refetch.
utils/str.ts Simplified useAccountsProfiles to directly use usePreferredNames, removing local state management.
utils/xmtpRN/conversations.ts Added handleNewConversationCreation function; updated createConversation and createGroup for message streaming.
utils/xmtpRN/sync.ts Ensured account identifiers are handled in a case-insensitive manner in getXmtpClient.

Assessment against linked issues

Objective Addressed Explanation
Ensure messages are streamed when creating a new DM (Issue #1335)
Show requests on iOS when new conversations come in (Issue #1334)

Possibly related PRs

Suggested reviewers

  • thierryskoda

🐰 In the code we hop and play,
New properties come out to stay.
With refetching now in sight,
Our data flows with pure delight!
Accounts are simpler, oh what a cheer,
Let's code together, the future is near! 🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 927766c and 2e8e535.

📒 Files selected for processing (7)
  • features/conversation-requests-list/useRequestItems.tsx (1 hunks)
  • screens/Accounts/Accounts.tsx (1 hunks)
  • screens/Navigation/ConversationRequestsListNav.ios.tsx (2 hunks)
  • screens/Navigation/ConversationRequestsListNav.tsx (2 hunks)
  • utils/str.ts (2 hunks)
  • utils/xmtpRN/conversations.ts (6 hunks)
  • utils/xmtpRN/sync.ts (2 hunks)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

// if (groupName) {
// setGroupNameQueryData(account, group.topic, groupName);
// }
// }s
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be a stray 's' character after the comment closing. The line should be // } instead of // }s.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Contributor

github-actions bot commented Dec 10, 2024

Performance Comparison Report

  • Current: de71afe - 2024-12-10 14:31:02Z
  • Baseline: release/3.0.0 (0e58add) - 2024-12-10 14:29:41Z

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Type Duration Count
Avatar Image 10 runs render 1.1 ms → 1.1 ms 1 → 1
Avatar Image 50 runs render 1.1 ms → 1.1 ms 1 → 1
Empty Avatar 10 runs render 0.9 ms → 0.8 ms (-0.1 ms, -11.1%) 1 → 1
Empty Avatar 50 runs render 0.7 ms → 0.7 ms (-0.0 ms, -2.8%) 1 → 1
Text Component with color prop - 10 runs render 0.3 ms → 0.3 ms 1 → 1
Text Component with default props - 10 runs render 0.3 ms → 0.3 ms 1 → 1
Text Component with translation key - 10 runs render 0.2 ms → 0.5 ms (+0.3 ms, +150.0%) 🔴 1 → 1
Text Component with weight and size - 10 runs render 0.1 ms → 0.3 ms (+0.2 ms, +200.0%) 🔴 1 → 1
Show details
Name Type Duration Count
Avatar Image 10 runs render Baseline
Mean: 1.1 ms
Stdev: 0.3 ms (28.7%)
Runs: 1 1 1 1 1 1 1 1 2 1
Warmup runs: 2

Current
Mean: 1.1 ms
Stdev: 0.3 ms (28.7%)
Runs: 1 1 1 1 1 2 1 1 1 1
Warmup runs: 2
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Avatar Image 50 runs render Baseline
Mean: 1.1 ms
Stdev: 0.3 ms (27.5%)
Runs: 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 2 1
Warmup runs: 1

Current
Mean: 1.1 ms
Stdev: 0.3 ms (27.5%)
Runs: 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:
Empty Avatar 10 runs render Baseline
Mean: 0.9 ms
Stdev: 0.3 ms (35.1%)
Runs: 1 1 1 1 1 1 1 1 0 1
Warmup runs: 3

Current
Mean: 0.8 ms
Stdev: 0.4 ms (52.7%)
Runs: 1 1 1 0 1 1 1 0 1 1
Warmup runs: 3
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Empty Avatar 50 runs render Baseline
Mean: 0.7 ms
Stdev: 0.5 ms (63.0%)
Runs: 1 1 0 0 1 1 0 1 1 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 0 1 1 0 1 0 1 1 0 1 1
Warmup runs: 1

Current
Mean: 0.7 ms
Stdev: 0.5 ms (66.1%)
Runs: 0 1 1 1 1 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 0 0 0 0 1 1 1 0 0 1
Warmup runs: 0
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with color prop - 10 runs render Baseline
Mean: 0.3 ms
Stdev: 0.5 ms (161.0%)
Runs: 1 0 0 1 0 0 0 0 1 0
Warmup runs: 0

Current
Mean: 0.3 ms
Stdev: 0.5 ms (161.0%)
Runs: 0 0 1 0 1 0 0 1 0 0
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with default props - 10 runs render Baseline
Mean: 0.3 ms
Stdev: 0.5 ms (161.0%)
Runs: 1 0 0 0 1 1 0 0 0 0
Warmup runs: 0

Current
Mean: 0.3 ms
Stdev: 0.5 ms (161.0%)
Runs: 0 1 1 1 0 0 0 0 0 0
Warmup runs: 0
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with translation key - 10 runs render Baseline
Mean: 0.2 ms
Stdev: 0.4 ms (210.8%)
Runs: 0 0 0 0 0 0 1 0 0 1
Warmup runs: 0

Current
Mean: 0.5 ms
Stdev: 0.5 ms (105.4%)
Runs: 0 0 1 0 0 1 0 1 1 1
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with weight and size - 10 runs render Baseline
Mean: 0.1 ms
Stdev: 0.3 ms (316.2%)
Runs: 0 0 0 0 0 0 0 1 0 0
Warmup runs: 0

Current
Mean: 0.3 ms
Stdev: 0.5 ms (161.0%)
Runs: 1 0 0 1 1 0 0 0 0 0
Warmup runs: 0
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Render Count Changes

There are no entries

Render Issues

There are no entries

Added Scenarios

There are no entries

Removed Scenarios

There are no entries

Generated by 🚫 dangerJS against 2e8e535

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (1)
utils/str.ts (1)

68-70: LGTM! Consider adding type annotations for better maintainability.

The simplification of useAccountsProfiles using usePreferredNames is a good improvement. Consider adding explicit return type annotation for better type safety and documentation.

Here's a suggested improvement:

-export const useAccountsProfiles = () => {
+export const useAccountsProfiles = (): string[] => {
   const accounts = useAccountsList();
   const accountNames = usePreferredNames(accounts);
   return accountNames;
 };
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between dc78124 and 927766c.

📒 Files selected for processing (7)
  • features/conversation-requests-list/useRequestItems.tsx (1 hunks)
  • screens/Accounts/Accounts.tsx (1 hunks)
  • screens/Navigation/ConversationRequestsListNav.ios.tsx (2 hunks)
  • screens/Navigation/ConversationRequestsListNav.tsx (2 hunks)
  • utils/str.ts (2 hunks)
  • utils/xmtpRN/conversations.ts (6 hunks)
  • utils/xmtpRN/sync.ts (2 hunks)
🔇 Additional comments (8)
features/conversation-requests-list/useRequestItems.tsx (1)

4-11: LGTM! Hook enhancement supports pull-to-refresh functionality.

The addition of isRefetching and refetch properties aligns with the PR objective of implementing pull-to-refresh for the request list.

Let's verify the hook usage in consuming components:

✅ Verification successful

Hook usage verified and properly implemented in consuming components

The verification confirms that both ConversationRequestsListNav.tsx and its iOS variant correctly destructure and utilize the new isRefetching and refetch properties from useRequestItems hook, ensuring proper implementation of the pull-to-refresh functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for components using useRequestItems to ensure they handle the new properties
rg -l "useRequestItems" | xargs ast-grep --pattern 'const { $$$, isRefetching, refetch } = useRequestItems()'

Length of output: 505

utils/xmtpRN/sync.ts (1)

33-35: Ensure consistent case handling for account identifiers.

The changes improve robustness by enforcing case-insensitive account handling. However, let's verify that this change doesn't affect existing account lookups.

Consider extracting the account normalization logic into a utility function for consistency:

+const normalizeAccount = (account: string): string => account.toLowerCase();
+
 export const getXmtpClient = async (
   account: string
 ): Promise<ConverseXmtpClientType | Client> => {
-  const lowerCaseAccount = account.toLowerCase();
+  const lowerCaseAccount = normalizeAccount(account);

Also applies to: 38-38, 48-48, 55-55, 61-61, 64-64

✅ Verification successful

Case-insensitive account handling is correctly implemented and consistent.

The verification shows that:

  1. All direct accesses to xmtpClientByAccount in sync.ts use the lowerCaseAccount variable, which is consistently derived from account.toLowerCase().
  2. The only place where the original account is used with xmtpClientByAccount is in deleteXmtpClient, but this is safe as it's a cleanup operation where missing a key wouldn't cause issues.
  3. The case-insensitive handling is properly synchronized with the instantiation tracking in instantiatingClientForAccount.

The refactoring suggestion to extract the normalization function would be a good enhancement, but the current implementation is correct and safe.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any mixed-case account references that might be affected
rg -i "xmtpClientByAccount\[(?!\w+\.toLowerCase\(\))" -A 2

Length of output: 330


Script:

#!/bin/bash
# Let's try a simpler search pattern to find any direct usage of xmtpClientByAccount
rg "xmtpClientByAccount\[" -A 2

# Also search for any other references to this object
rg "xmtpClientByAccount" -A 2

# Let's also check the full file content to understand the context better
cat utils/xmtpRN/sync.ts

Length of output: 8277

screens/Navigation/ConversationRequestsListNav.tsx (1)

39-40: LGTM: Pull-to-refresh implementation looks good.

The addition of isRefetching and refetch props enhances the user experience by providing feedback during data refresh operations.

Also applies to: 164-169

screens/Navigation/ConversationRequestsListNav.ios.tsx (1)

36-37: LGTM: iOS implementation maintains consistency.

The changes mirror the non-iOS version, ensuring consistent behavior across platforms.

Also applies to: 175-180

✅ Verification successful

Verified: iOS implementation maintains consistency with non-iOS version

The verification confirms that both implementations:

  • Use identical useRequestItems hook with the same destructured properties: likelySpam, likelyNotSpam, isRefetching, refetch
  • Pass the same props to ConversationFlashList: isRefetching, refetch, and items (though named itemsToShow in iOS and items in non-iOS)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify consistency between iOS and non-iOS implementations
diff <(rg -A 5 "ConversationFlashList" screens/Navigation/ConversationRequestsListNav.tsx) <(rg -A 5 "ConversationFlashList" screens/Navigation/ConversationRequestsListNav.ios.tsx)

Length of output: 288


Script:

#!/bin/bash
# Let's first check if these files exist and their content
fd "ConversationRequestsListNav" --type f

# Then let's examine the content of both files focusing on the relevant sections
echo "=== iOS Version ==="
rg -B 2 -A 5 "useRequestItems|ConversationFlashList" "screens/Navigation/ConversationRequestsListNav.ios.tsx" || true

echo -e "\n=== Non-iOS Version ==="
rg -B 2 -A 5 "useRequestItems|ConversationFlashList" "screens/Navigation/ConversationRequestsListNav.tsx" || true

Length of output: 3099

utils/xmtpRN/conversations.ts (4)

17-17: LGTM: Import addition aligns with streaming functionality

The addition of streamAllMessages import supports the PR's objective of fixing message streaming in new conversations.


314-314: LGTM: Conversation creation now properly handles message streaming

The addition of handleNewConversationCreation ensures that message streaming is restarted after creating a new conversation, addressing the core issue mentioned in PR objectives.


Line range hint 346-360: LGTM: Group creation now properly handles message streaming

The refactored implementation properly stores the group creation result, adds logging, and ensures message streaming is restarted.


544-554: 🛠️ Refactor suggestion

Add error handling and consider parameter usage

While the implementation addresses the streaming issue, consider these improvements:

  1. Add error handling for streamAllMessages call
  2. Either use or remove the unused _conversation parameter
  3. Add more context about when this workaround can be removed

Consider this implementation:

 const handleNewConversationCreation = async (
   client: ConverseXmtpClientType,
-  _conversation: ConversationWithCodecsType
+  conversation: ConversationWithCodecsType
 ) => {
   logger.info(
-    "[XMTPRN Conversations] Restarting message stream to handle new conversation"
+    `[XMTPRN Conversations] Restarting message stream for conversation ${conversation.topic}`
   );
-  await streamAllMessages(client.address);
+  try {
+    await streamAllMessages(client.address);
+  } catch (error) {
+    logger.error(
+      `[XMTPRN Conversations] Failed to restart message stream: ${error}`
+    );
+    throw error;
+  }
 };
✅ Verification successful

Add error handling and use retryWithBackoff for message streaming

The review comment is valid but can be improved. Based on the codebase analysis:

  1. The streamAllMessages function is already wrapped with retryWithBackoff in the sync process (utils/xmtpRN/sync.ts), providing robust error handling with retries.
  2. The unused _conversation parameter should be utilized as suggested in the review.
  3. The TODO comment is appropriate as it references an open GitHub issue (Fix restore group swipe action icon invisible in iOS dark mode  #560) for tracking the temporary nature of this workaround.
 const handleNewConversationCreation = async (
   client: ConverseXmtpClientType,
-  _conversation: ConversationWithCodecsType
+  conversation: ConversationWithCodecsType
 ) => {
   logger.info(
-    "[XMTPRN Conversations] Restarting message stream to handle new conversation"
+    `[XMTPRN Conversations] Restarting message stream for conversation ${conversation.topic}`
   );
-  await streamAllMessages(client.address);
+  await retryWithBackoff({
+    fn: () => streamAllMessages(client.address),
+    retries: 5,
+    delay: 1000,
+  });
 };
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check the referenced GitHub issue status
gh issue view 560 --repo xmtp/xmtp-react-native --json state,title,body

Length of output: 570


Script:

#!/bin/bash
# Check for error handling patterns in similar async functions
ast-grep --pattern 'try {
  $$$
  await streamAllMessages($$$)
  $$$
} catch'

# Check for other usages of streamAllMessages to understand error handling patterns
rg "streamAllMessages" -A 2 -B 2

Length of output: 2816


Script:

#!/bin/bash
# Check how retryWithBackoff is implemented for error handling
rg "retryWithBackoff" -A 5 -B 5

# Check the implementation of streamAllMessages in messages.ts
cat utils/xmtpRN/messages.ts

Length of output: 13459

Comment on lines +40 to +42
items={accountsProfiles.map((a) => ({
id: a,
title: accountsProfiles[a] || shortAddress(a),
title: a,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider improving account address readability in the UI.

The account address is now displayed directly without formatting, which might impact readability. Consider using the existing shortAddress or getReadableProfile utility to format the address.

Here's a suggested improvement:

  items={accountsProfiles.map((a) => ({
    id: a,
-   title: a,
+   title: getReadableProfile(a, a), // or shortAddress(a) for a simpler approach
    action: () => {

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines 389 to 392

// if (groupName) {
// setGroupNameQueryData(account, group.topic, groupName);
// }
// }s
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Based on the gathered evidence, I can now provide a final response:

Remove commented metadata setting code as it's handled elsewhere

The commented code block can be safely removed because:

  1. The metadata setting functionality is actively used in other parts of the codebase (utils/groupUtils/handle*Update.ts files)
  2. The group metadata is already being set during group creation via the createGroup function parameters
  3. The code has been replaced with handleNewConversationCreation which handles the post-creation workflow
🔗 Analysis chain

Clean up or restore commented metadata setting code

There's commented out code for setting group metadata. This should either be:

  1. Removed if it's no longer needed
  2. Restored if the functionality is still required
  3. Documented with a TODO if it's temporarily disabled

Please clarify the intended handling of this code.


Let me gather more context about this specific code section to understand if this commented code is still needed or can be safely removed.


Let me check one more thing to see if this metadata setting functionality is handled elsewhere in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if these metadata functions are used elsewhere in the codebase
rg "setGroup(Name|Photo|Description)QueryData"

Length of output: 2941


Script:

#!/bin/bash
# Check the git history of this specific section to understand when and why it was commented out
git log -L389,392:utils/xmtpRN/conversations.ts

# Look for any related group metadata setting code in the same file
rg -A 5 "groupName|groupPhoto|groupDescription" utils/xmtpRN/conversations.ts

Length of output: 1376


Script:

#!/bin/bash
# Check for handleNewConversation usage and implementation
rg -A 10 "handleNewConversation" 

# Check if there's any other place where group metadata is set after creation
ast-grep --pattern 'createGroup($$$).then($$$setGroup$$$)'
ast-grep --pattern 'createGroupByAccount($$$).then($$$setGroup$$$)'

Length of output: 6419

Copy link
Member

@lourou lourou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until it's fixed in libxmtp

Restart message stream when creating a new conversation
Updated Accounts list to use query
Added pull to refresh for request list
@alexrisch alexrisch force-pushed the ar/stream-messages-new-dm branch from 927766c to 2e8e535 Compare December 10, 2024 14:26
@alexrisch alexrisch merged commit 0e58add into release/3.0.0 Dec 10, 2024
4 of 5 checks passed
@alexrisch alexrisch deleted the ar/stream-messages-new-dm branch December 10, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants