-
Notifications
You must be signed in to change notification settings - Fork 7
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
UI: display 'no data' if backend returns none in home page #147
UI: display 'no data' if backend returns none in home page #147
Conversation
ErnestaP
commented
Nov 28, 2023
- ref: When the user's request is throttled, main page crashes cern-sis/issues-scoap3#247
ui/package.json
Outdated
@@ -11,6 +11,7 @@ | |||
"dependencies": { | |||
"@ant-design/cssinjs": "^1.17.2", | |||
"antd": "^5.10.1", | |||
"lodash": "^4.17.21", |
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.
why do we need lodash, I don't see using it in the PR :)
ui/src/pages/index.tsx
Outdated
@@ -63,8 +72,9 @@ export const getServerSideProps: GetServerSideProps = async () => { | |||
|
|||
const res = await fetch(`${getApiUrl() + getSearchUrl(query)}`, authToken); | |||
const { count, facets } = (await res?.json()) as Response; | |||
|
|||
return { props: { count, facets, query } }; | |||
const countValue = { count: count ? count : 0 }; |
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.
const countValue = { count: count ? count : 0 }; | |
const countValue = { count: count || 0 }; |
ui/src/pages/index.tsx
Outdated
|
||
return { props: { count, facets, query } }; | ||
const countValue = { count: count ? count : 0 }; | ||
const facetsValue = { facets: facets ? facets : null }; |
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.
same
81729f6
to
d120a3e
Compare
d120a3e
to
743a296
Compare