-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fabri QA for frames & deeplinks #1098
Conversation
WalkthroughThe changes in this pull request involve modifications to three components: Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Performance Comparison ReportSignificant Changes To DurationThere are no entries Meaningless Changes To DurationShow entries
Show details
Render Count ChangesThere are no entries Render IssuesThere are no entries Added ScenariosThere are no entries Removed ScenariosThere are no entries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (3)
utils/regex.ts (1)
3-4
: LGTM: Boundary end pattern correctly updated.The end boundary pattern properly mirrors the start boundary changes, maintaining consistency in quote handling.
Consider grouping similar characters in the regex for better readability:
-const BOUNDARY_END_LOOKAHEAD = /(\s|\)|$|\.|!|\?|\r\n|\r|\n|"|')/.source; +const BOUNDARY_END_LOOKAHEAD = /(\s|\)|"|'|$|\.|!|\?|\r\n|\r|\n)/.source;components/Chat/ChatPlaceholder/GroupChatPlaceholder.tsx (1)
79-79
: Use defined style instead of inline styleThe component has a defined
activitySpinner
style that should be used instead of the inline style for better maintainability.- {!topic && <ActivityIndicator style={{ marginBottom: 20 }} />} + {!topic && <ActivityIndicator style={styles.activitySpinner} />}screens/Conversation.tsx (1)
118-119
: LGTM! Consider adding a comment for clarity.This change correctly prevents duplicate navigation when already in a conversation, addressing the issue with duplicate alerts. Consider adding a comment to explain the purpose:
+ // Prevent opening main conversation if already in a conversation !openedMainConvo.current && !conversationTopicRef.current
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- components/Chat/ChatPlaceholder/GroupChatPlaceholder.tsx (3 hunks)
- screens/Conversation.tsx (3 hunks)
- utils/regex.ts (1 hunks)
🔇 Additional comments (5)
utils/regex.ts (2)
1-2
: LGTM: Boundary start pattern correctly updated.The addition of quote characters to the lookbehind pattern properly implements the requirement to allow quotes around clickable links.
Line range hint
7-11
: Verify the boundary changes work correctly for all domain patterns.The boundary pattern changes affect all domain-specific regex patterns. Let's verify the changes work as expected.
Also applies to: 19-27
✅ Verification successful
Let's examine the actual implementation before verifying the pattern changes. The previous test had issues with regex syntax in ripgrep, so we'll first understand how these patterns are actually defined and used in the codebase.
The boundary pattern changes are correctly implemented for all domain patterns
The code inspection reveals that:
- All domain patterns (LENS_REGEX, ETH_REGEX, FARCASTER_REGEX, CB_ID_REGEX, UNS_REGEX) consistently use the
getDomainExpression
function- The boundary patterns are well-defined with proper handling of:
- Start boundaries: spaces, parentheses, quotes (both single and double), and line start
- End boundaries: spaces, parentheses, quotes, line endings, and common punctuation
- Word content: correctly excludes problematic characters like spaces, slashes, and parentheses
- The implementation ensures uniform behavior across all domain-specific patterns through the shared
getDomainExpression
functionThe changes work correctly for all domain patterns as they share the same boundary handling logic through the centralized implementation.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Test the updated regex patterns with various quote combinations # Create a test file with various domain formats cat << 'EOF' > test_domains.txt normal.eth "test.eth" 'test.eth' (test.eth) test.lens "test.lens" 'test.fc' (test.cb.id) EOF # Use ripgrep to verify the patterns match correctly echo "Testing ETH domains:" rg "(\s|\(|\"|')([^()/\s]*\.eth)(\s|\)|\$|\.|!|\?|\r\n|\r|\n|\"|')" test_domains.txt echo -e "\nTesting LENS domains:" rg "(\s|\(|\"|')([^()/\s]*\.lens)(\s|\)|\$|\.|!|\?|\r\n|\r|\n|\"|')" test_domains.txt echo -e "\nTesting Farcaster domains:" rg "(\s|\(|\"|')([^()/\s]*\.fc)(\s|\)|\$|\.|!|\?|\r\n|\r|\n|\"|')" test_domains.txtLength of output: 1030
Script:
#!/bin/bash # Let's examine the actual regex patterns in the codebase first echo "Searching for regex pattern definitions:" rg "(?:const|let|var).*(?:LENS_REGEX|ETH_REGEX|FC_REGEX)" -A 3 echo -e "\nSearching for getDomainExpression usage:" rg "getDomainExpression" -A 2 echo -e "\nLooking for boundary constants:" rg "(?:const|let|var).*(?:BOUNDARY_START|BOUNDARY_END|WORD_CONTENT)" -A 1Length of output: 2109
components/Chat/ChatPlaceholder/GroupChatPlaceholder.tsx (2)
6-6
: LGTM: Clean implementation of topic-based error handlingThe addition of
isGroupTopic
import andtopic
context usage effectively supports the PR objective of re-enabling the "Convo not found" and "Group not found" pages.Also applies to: 29-29
Line range hint
29-85
: Verify integration with deeplink navigationWhile the error page implementation looks correct, we should verify that this component properly integrates with the deeplink navigation fix mentioned in the PR objectives.
✅ Verification successful
Let me analyze the navigation integration with a different approach. The previous command failed due to file type specification, so I've broadened the search with correct file extensions and also focused on the component's directory for navigation-related code.
I see navigation-related code in various Chat components, but I need to verify specifically how the deeplink navigation interacts with the GroupChatPlaceholder component. Let's search for deeplink handlers and the navigation setup related to this component.
Based on the search results, I can now generate a final response as we have sufficient information about the deeplink navigation implementation and its interaction with the component.
The GroupChatPlaceholder component correctly integrates with deeplink navigation
The implementation properly supports the deeplink navigation fix through:
- The component's error states align with the navigation system's group deeplink handling (
group?groupId=...
)- The placeholder's topic-based rendering (
isGroupTopic(topic)
) matches the group navigation state parsing innavHelpers.ts
- Error messages are correctly displayed while the navigation state is being processed (
opening_conversation
during loading)🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for deeplink handling logic that might interact with this component rg -l "deeplink|navigation" --type tsxLength of output: 68
Script:
#!/bin/bash # Search for deeplink handling logic that might interact with this component, using broader file extensions rg -l "deeplink|navigation" --type ts --type tsx --type jsx --type js # Also search for any routing or navigation related imports/usage in the component's directory rg -A 3 "import.*[Nn]avigation|useNavigation|deeplink" ./components/ChatLength of output: 6525
Script:
#!/bin/bash # Let's check the navigation implementation in the screens directory and any potential deeplink handlers rg -A 5 "deeplink|Deeplink" . # Also check for the specific navigation setup that might handle the group chat routing rg -A 5 "GroupChatPlaceholder|ChatPlaceholder" ./screensLength of output: 3990
screens/Conversation.tsx (1)
Line range hint
290-305
: LGTM! Verify GroupChatPlaceholder usage.The addition of
topic
to the conversation context correctly restores the functionality for error pages. This change aligns with React best practices and properly maintains the dependency array.Let's verify the GroupChatPlaceholder component is correctly consuming this context:
✅ Verification successful
Based on the search results, I can now generate the final response since I have found sufficient evidence about how the topic is being consumed in GroupChatPlaceholder:
Topic is correctly consumed in GroupChatPlaceholder using useConversationContext
The GroupChatPlaceholder component is properly consuming the topic from ConversationContext using the
useConversationContext
hook:// components/Chat/ChatPlaceholder/GroupChatPlaceholder.tsx const topic = useConversationContext("topic");This implementation correctly uses the context selector pattern to access the topic value that was added to the conversation context.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify GroupChatPlaceholder uses the topic from context # Expected: Find usage of topic from ConversationContext in GroupChatPlaceholder ast-grep --pattern 'const { topic } = useContext(ConversationContext)'Length of output: 72
Script:
#!/bin/bash # Let's try a broader search for GroupChatPlaceholder component and its context usage rg -A 5 "GroupChatPlaceholder" # Also search for any usage of ConversationContext rg -A 5 "ConversationContext" # And specifically look for topic usage in components ast-grep --pattern 'useContext($context)'Length of output: 35689
{topic | ||
? isGroupTopic(topic) | ||
? translate("group_not_found") | ||
: translate("conversation_not_found") | ||
: translate("opening_conversation")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider extracting placeholder text logic for better readability
While the logic correctly implements the error message requirements, the nested ternary operators could be simplified for better maintainability.
+ const getPlaceholderText = () => {
+ if (!topic) return translate("opening_conversation");
+ return isGroupTopic(topic)
+ ? translate("group_not_found")
+ : translate("conversation_not_found");
+ };
<Text style={styles.chatPlaceholderText}>
- {topic
- ? isGroupTopic(topic)
- ? translate("group_not_found")
- : translate("conversation_not_found")
- : translate("opening_conversation")}
+ {getPlaceholderText()}
</Text>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
{topic | |
? isGroupTopic(topic) | |
? translate("group_not_found") | |
: translate("conversation_not_found") | |
: translate("opening_conversation")} | |
const getPlaceholderText = () => { | |
if (!topic) return translate("opening_conversation"); | |
return isGroupTopic(topic) | |
? translate("group_not_found") | |
: translate("conversation_not_found"); | |
}; | |
<Text style={styles.chatPlaceholderText}> | |
{getPlaceholderText()} | |
</Text> |
<Text style={styles.chatPlaceholderText}> | ||
{translate("opening_conversation")} | ||
{topic | ||
? isGroupTopic(topic) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should always be a group topic as it's in the GroupChatPlaceholder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexrisch The check to display ChatPlaceholder or GroupChatPlaceholder is currently on conversation?.isGroup
so it only works if the conversation was found. Do you wanna change it to isGroupTopic(conversationTopic)
?
* Fabri QA for frames & deeplinks * also allow ' & " at beginning * comments
More deeplink issues fixes
'
and"
to be at around a clickable ENSSummary by CodeRabbit
New Features
Bug Fixes
Chores