Skip to content

Feature/autocomplete#149#165

Open
saikarthikbattula wants to merge 24 commits into
developfrom
feature/Autocomplete#149
Open

Feature/autocomplete#149#165
saikarthikbattula wants to merge 24 commits into
developfrom
feature/Autocomplete#149

Conversation

@saikarthikbattula
Copy link
Copy Markdown
Contributor

@saikarthikbattula saikarthikbattula commented Apr 8, 2026

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
utd-notebook Ready Ready Preview, Comment Jun 5, 2026 4:13am

Request Review

@TyHil TyHil linked an issue Apr 8, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

@ShriramJana ShriramJana left a comment

Choose a reason for hiding this comment

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

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.

@saikarthikbattula
Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Member

@TyHil TyHil left a comment

Choose a reason for hiding this comment

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

Looking really good! Just a few small changes and waiting on a look from Ethan

Comment thread src/components/header/SearchBar.tsx Outdated
Comment thread src/components/header/SearchBar.tsx Outdated
Comment thread src/components/form/FormSelect.tsx
Comment thread src/app/api/autocomplete/route.ts Outdated
Comment thread src/app/api/autocomplete/route.ts
- 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
 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.
@TyHil
Copy link
Copy Markdown
Member

TyHil commented Jun 3, 2026

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

@saikarthikbattula
Copy link
Copy Markdown
Contributor Author

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

@TyHil
Copy link
Copy Markdown
Member

TyHil commented Jun 4, 2026

The check that's failing is the Vercel build. All it does is run npm run build just like you would do to build the app on your machine. So you can see why it's failing by just running npm run build locally.

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

@saikarthikbattula
Copy link
Copy Markdown
Contributor Author

saikarthikbattula commented Jun 5, 2026

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

@TyHil
Copy link
Copy Markdown
Member

TyHil commented Jun 5, 2026

Gotcha, yeah if you revert back to 71b3aff (the commit before you changed FormFile) and run npm run build the error is actually in the SearchBar file and you can diagnose the problem from there. Good luck and lmk if I can help

@TyHil
Copy link
Copy Markdown
Member

TyHil commented Jun 5, 2026

Oh wow you're quick! I'll review it

@TyHil TyHil self-requested a review June 5, 2026 03:36
Copy link
Copy Markdown
Member

@TyHil TyHil left a comment

Choose a reason for hiding this comment

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

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

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.

Autocomplete show if we have notes

3 participants