Feature/autocomplete#149#165
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ShriramJana
left a comment
There was a problem hiding this comment.
Hey @saikarthikbattula, nice work on this! A few things to address before we can merge:
1. Performance: DB query on every autocomplete request
The autocomplete route now hits the database (joining section + file) on every keystroke search. This could introduce lag as data grows, since autocomplete needs to feel instant. Consider caching this data (a set of course/professor combos that have notes, refreshed periodically) instead of querying live on every request.
2. Professor redirect passes wrong value
When a professor has no notes and the user clicks it, the redirect goes to /notes/create?course=John Smith. The NoteForm then pre-fills this into the section field, which expects a course format like CS 3341, not a professor name. This will either show an invalid value or confuse the user.
Please also add a description explaining what the PR does and how to test it. This helps reviewers and keeps our PR history useful.
|
Hey @ShriramJana, thank you for your comment and I have made the proposed changes. Please let me know if there is anything else I need to do. |
TyHil
left a comment
There was a problem hiding this comment.
Looking really good! Just a few small changes and waiting on a look from Ethan
- Change from global cache to per-result caching - Reduce TTL from 5 minutes to 1 minute for faster updates - Add targeted database queries for better performance - Add generateSectionsData script for build process
…la/utd-notebook into feature/Autocomplete#149
While testing the new autocomplete features, the build was failing due to missing type definitions and unhandled props across two files: FormFile.tsx and SearchQuery.tsx. 1. Why FormFile.tsx was updated: NoteForm.tsx was passing existingFile and isError props to the <FormFile> component to handle edit-mode states, but the component didn't actually accept or handle those props. To fix the type errors and support the UI, I expanded FormFileProps to accept them. FormFile now properly displays the currently uploaded file name during edits and shows a red border when validation fails. 2. Why SearchQuery.tsx was updated: The new SearchBar component relies on the removeDuplicates function to filter recent searches, and the SearchQueryWithTitle type for its autocomplete options. However, these were either missing or had syntax errors in the SearchQuery.tsx file on this branch. I implemented the removeDuplicates utility function and exported the SearchQueryWithTitle type so SearchBar can compile and function correctly.
…la/utd-notebook into feature/Autocomplete#149
|
It is summer but wanted to see how work on this is going. I'm going to have a couple weeks before my job starts that I might try and wrap some stuff leftover from the semester up during |
Not sure what is failing on the deployment side of things. Worked once but didn't work again after I made changes to it |
|
The check that's failing is the Vercel build. All it does is run The error is in FormFile tho and I don't think changes are needed in that file for this issue. You could do that in another pull request if you feel it's needed. Be careful with any AI use if that is what changed that file. Lmk if you're gonna work on this or if I should pick it up later tho |
|
When I tried running the npm run build, I did have issues running it and AI pointed to the FormFile and made the changes. After that, the build was working perfectly. I will try to fix the issue asap |
|
Gotcha, yeah if you revert back to 71b3aff (the commit before you changed |
|
Oh wow you're quick! I'll review it |
TyHil
left a comment
There was a problem hiding this comment.
Somehow all of your changes to SearchBar and NoteForm weren't here anymore so I readded them. Thanks for switching to caching each course/prof tho, this looks great!
@ZeyadAbbas ready for your final review and merge
Enhanced autocomplete to indicate whether a course or professor has notes available before navigation. This improves user experience by making it clear which results already contain notes and routing users appropriately when they don’t. Each autocomplete result now reflects note availability and guides users either to existing notes or directly to the note creation flow with prefilled context.
Changes
Extended autocomplete logic to include note existence information for each course/professor result
Added backend support to determine whether a course/professor has associated notes
Updated autocomplete response format to include a hasNotes flag per result
Introduced UI indicators in autocomplete:
Note icon for items with existing notes
Plus icon for items without notes
Updated navigation behavior:
If notes exist → route to notes page
If no notes exist → route to create note page
Added query param support to prefill course/professor fields on the create note page