-
Notifications
You must be signed in to change notification settings - Fork 2
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
Server render search results (search and channel pages) #1836
base: main
Are you sure you want to change the base?
Conversation
Merge branch 'main' into jk/5919-prefetch-mechanism
The search results don't seem to be pre-rendered but I'm guessing it's something wrong with my development environment. Will message you about it first thing tomorrow morning since you're probably done for the day |
I've removed a cache invalidation just now in 8d52ff1, which we no longer need and which would cause the search API to be called again on page load. This wouldn't have been preventing server rendering but could that have been the reason it didn't appear to be server rendering? |
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.
LGTM - works great!
What are the relevant tickets?
Closes:
Next.js: Search page: Prefetch API calls #6035
Next.js: Channel details page search: Prefetch API calls #6037
Description (What does it do?)
Prefetches search results for the search and channel details pages.
Dependency on #1846 to merge first - this is need to apply user list and learning path relationships to the learning resources (server rendered resources won't have them).Done.This also needs mitodl/course-search-utils#159 to be published before merging.Done.How can this be tested?
On the search page /search and channel pages e.g. /c/topic/architecture, /c/department/media-arts-and-sciences, /c/unit/mitx, make various changes to the following, refreshing after each and ensuring that the search results are prerendered on the server with no calls made to /api/v1/learning_resources_search/ on first render and no prefetch warnings in the dev tools console:
The search results should render ok on first load with JavaScript disabled in the dev tools debugger settings.
Additional Context
Includes some refactoring to pull out
getSearchParams()
for reuse and provide arequestSearchParams()
to convert Next.js parsed querystrings to our params forlearningResources.search()
API calls.