Refactor: Simplify navigation and slash command handling - #381
Merged
Conversation
- Sidebar: Remove preventDefault() and manual navigate() from NavLinks The NavLink component from React Router handles navigation internally. Using preventDefault() + navigate() was breaking the native behavior. Now only close sidebar on mobile without blocking navigation. - Chat: Add slash command detection in handleSubmit Previously, all input was sent via onSendMessage even for commands. Now checks if input starts with '/' and calls onCommandExecute instead. This properly executes commands like /task instead of sending as text. https://claude.ai/code/session_01QyDFbYooCiwJNR7CjdcW3Y
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Description
This PR refactors navigation logic in the AppSidebar component and improves slash command handling in CommandInput. The changes remove unnecessary programmatic navigation that was overriding React Router's built-in NavLink functionality, and add proper slash command execution support.
Key Changes:
AppSidebar.tsx:
useNavigatehook import and usageonClickhandlers to rely on React Router's native navigatione.preventDefault()calls that were preventing default NavLink behaviorCommandInput.tsx:
/) are now intercepted and executed viaonCommandExecutecallback🎯 Type of Change
🔗 Related Issues
✅ Checklist
Code Quality
Testing
Documentation
Dependencies
Security
🧪 How Has This Been Tested?
Manual testing recommended for:
📝 Additional Notes
The refactoring leverages React Router's built-in NavLink functionality instead of manually managing navigation with
useNavigate(). This is a cleaner approach that:The slash command handling addition enables proper command execution flow while maintaining backward compatibility with regular message sending.
👀 Reviewer Notes
Areas needing special attention:
Questions for reviewers:
https://claude.ai/code/session_01QyDFbYooCiwJNR7CjdcW3Y