Convert export page to be CSR#876
Open
thostetler wants to merge 5 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #876 +/- ##
========================================
+ Coverage 62.6% 62.7% +0.1%
========================================
Files 324 325 +1
Lines 38203 38184 -19
Branches 1733 1733
========================================
+ Hits 23903 23920 +17
+ Misses 14259 14223 -36
Partials 41 41
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
src/pages/search/exportcitation/[format].tsx:163
- In the
getServerSidePropserror path,formatis omitted from returnedpropseven though the page expects it (and uses it to derive bibtex settings). Return a sensibleformatfallback (e.g., the URL param orExportApiFormatKey.bibtex) in the catch block to keep rendering consistent.
} catch (error) {
logger.error({ msg: 'GSSP error in export citation page', error });
return {
props: {
query: searchParams,
pageError: parseAPIError(error),
error: axios.isAxiosError(error) ? error.message : 'Unable to fetch data',
},
};
Comment on lines
26
to
34
| @@ -35,10 +34,9 @@ interface IExportCitationPageProps { | |||
| } | |||
Comment on lines
120
to
134
| export const getServerSideProps: GetServerSideProps = composeNextGSSP(async (ctx) => { | ||
| const { | ||
| qid = null, | ||
| p, | ||
| referrer = null, | ||
| ...query | ||
| } = parseQueryFromUrl<{ qid: string; format: string }>(ctx.req.url, { sortPostfix: 'id asc' }); | ||
|
|
||
| const { format } = ctx.params as { format: string }; | ||
|
|
||
| if (!query && !qid) { | ||
| return { | ||
| props: { | ||
| format, | ||
| query, | ||
| qid, | ||
| referrer, | ||
| error: 'No Records', | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| const queryClient = new QueryClient(); | ||
| const params: IADSApiSearchParams = { | ||
| const searchParams: IADSApiSearchParams = { | ||
| rows: APP_DEFAULTS.EXPORT_PAGE_SIZE, | ||
| fl: ['bibcode'], | ||
| sort: query.sort ?? APP_DEFAULTS.SORT, | ||
| ...(qid ? { q: `docs(${qid})` } : query), | ||
| }; |
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.
Export page has been extremely slow to load, and since most of the wait is done server-side waiting on the API to respond we can offload that to the client to take advantage of the RC caching and being able to show skeletons.
This also removes the infinite style calls, which probably aren't necessary here.