-
Notifications
You must be signed in to change notification settings - Fork 1
button navigation fix #156
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c95a4db
button navigation fix
aristachauhan 5880ae5
changed conditional + removed default
aristachauhan 54b144e
comment
aristachauhan 492e9ee
url updates now
aristachauhan 87aa7fa
changed order of reloads
aristachauhan 95c6294
change to replace
aristachauhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
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.
Hardcoded group value and missing dependency will break navigation for non-ucdavis groups.
Two issues in this effect:
Inconsistent group handling: Line 28 dynamically checks
aiState.group, but line 33 hardcodes/ucdavis/instead of using${aiState.group}. This breaks navigation for any group other than "ucdavis".Missing dependency:
aiState.groupis used in the condition but not included in the dependency array, violating React's exhaustive-deps rule and potentially causing stale closure bugs.🐛 Proposed fix
if ( // on first response from AI pathname === `/${aiState.group}/chat/new` && aiState.id !== '' // id is set only once the chat has been saved to the db ) { // reloads the sidebar, which repulls from the db now that the chat has been saved router.refresh(); - window.history.pushState({}, '', `/ucdavis/chat/${aiState.id}`); // change to group + window.history.pushState({}, '', `/${aiState.group}/chat/${aiState.id}`); } - }, [aiState.messages, router, aiState.id, pathname]); + }, [aiState.messages, router, aiState.id, aiState.group, pathname]);📝 Committable suggestion
🤖 Prompt for AI Agents