-
Notifications
You must be signed in to change notification settings - Fork 14
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
thuang-765-next-js #926
thuang-765-next-js #926
Conversation
5b9a3ec
to
13acc4a
Compare
@@ -1,61 +1,71 @@ | |||
# Local Development Environment |
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.
prettier change and changing Frontend app port from 8000 to 3000
@@ -1,4 +1,4 @@ | |||
version: '3.8' |
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.
prettier change and s/8000/3000
@@ -58,16 +58,16 @@ typings/ | |||
# configs |
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.
Nextjs and Gatsby need different .gitignore config
@@ -0,0 +1,13 @@ | |||
module.exports = { |
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.
Babel config is now needed, since Nextjs doesn't use the plugin paradigm that Gatsby uses. This setting works along side with https://github.com/styled-components/babel-plugin-styled-components#readme
frontend/container_init.sh
Outdated
else | ||
npm run build | ||
exec gatsby serve --host 0.0.0.0 | ||
exec npm run build-and-start-prod -p 9000 |
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.
do prod build and serve
|
||
const DatasetUploadToast = Toaster.create({ |
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.
.create()
actually queries and inserts a new element in the DOM, which doesn't work for SSR. So I changed this to only call .create()
when .show()
is called on the client side
let id = ""; | ||
let isPrivate = false; | ||
|
||
if (Array.isArray(params)) { |
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.
This logic handles frontend/src/pages/collections/[...params].tsx
uploadedFiles={uploadedFiles} | ||
invalidateCollectionQuery={invalidateCollectionQuery} | ||
onSelect={setSelected} | ||
<> |
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.
The only change here is adding a wrapper <></>
and a <Head />
sibling to <ViewGrid />
frontend/tsconfig.json
Outdated
@@ -5,19 +5,40 @@ | |||
"esModuleInterop": true, |
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.
prettier changes and Nextjs config added some more TS related settings
@@ -4,7 +4,7 @@ export AWS_DEFAULT_REGION=us-west-2 | |||
export AWS_ACCESS_KEY_ID=nonce |
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.
prettier change and s/8000/3000
895b589
to
8da4424
Compare
}, | ||
"devDependencies": { | ||
"@babel/preset-react": "^7.12.13", |
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.
these two babel plugins are needed for jest
to work in frontend/jest/jest-preprocess.js
8da4424
to
7fda4a6
Compare
I'll ping Infra team tomorrow about this! Thank you! |
e93aa34
to
7b829be
Compare
}); | ||
|
||
await Promise.all([ | ||
page.waitForNavigation(), |
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.
we need to wait for navigation before asserting the URL. Otherwise this test will be flakey!
0be905b
to
b330db2
Compare
Codecov Report
@@ Coverage Diff @@
## main #926 +/- ##
=======================================
Coverage 94.28% 94.28%
=======================================
Files 73 73
Lines 4476 4476
=======================================
Hits 4220 4220
Misses 256 256
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
cdd2557
to
8e7b942
Compare
@@ -1,3 +1,5 @@ | |||
# WARNING: PLEASE MAKE SURE TO KEEP THIS FILE IN SYNC WITH `.dockerignore` |
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.
this warning is very important!! Otherwise RDEV might not work, because . dockerignore
might be ignoring things we no longer ignore in .gitignore
.
In our case, I updated .gitignore
to stop ignoring public/
folder, because Next.js uses it to build the app, but Gatsby used to require us to ignore that folder. But I didn't update .dockerignore
accordingly, which caused RDEV deploy to not work partially
# runs `npm run build && npm run serve` under the hood, | ||
# so we need to pass `-- -p 9000` to `npm run serve`, which | ||
# will then call `next start -p 9000` correctly | ||
exec npm run build-and-start-prod -- -- -p 9000 |
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.
this basically tells Next.js to run on port 9000
@@ -45,7 +45,11 @@ async function fetchCollection( | |||
_: unknown, |
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.
small update to collection queries to be more resilient to unexpected input
@@ -1,6 +1,6 @@ | |||
import { Button, H6, Intent } from "@blueprintjs/core"; |
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.
Start using next/router
return ( | ||
<LogoWrapper data-test-id="logo"> | ||
<StyledLogo size={small ? 100 : undefined} src={String(logo)} /> |
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.
No need StyledLogo
anymore, since we only have one size for logo
@@ -1,5 +1,6 @@ | |||
const configs = { | |||
API_URL: "https://api.cellxgene.dev.single-cell.czi.technology", | |||
SENTRY_DEPLOYMENT_ENVIRONMENT: "development", |
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.
setting up Sentry to capture CSP violation. However, this is not set up to capture build info like Explorer does at the moment
<link | ||
rel="manifest" | ||
href="/site.webmanifest" | ||
crossOrigin="use-credentials" |
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.
We need crossOrigin
here in order to send cookies along with the request to prevent redev from blocking and redirecting the request to Okta. Thanks to @jgadling for finding this solution 🎉
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!
@@ -1,4 +1,4 @@ | |||
import { memoize } from "lodash-es"; | |||
import memoize from "lodash/memoize"; |
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.
🔥 🌲
> | ||
{name} | ||
</CollectionTitleText> | ||
<Link href={`/collections/${id}${isPrivate ? "/private" : ""}`}> |
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.
This might be useful so we don't need to have redudent hrefs
jsx-eslint/eslint-plugin-jsx-a11y#402 (comment)
56932a4
to
16bcf03
Compare
#765
Live link: https://thuang-next-js-frontend.rdev.single-cell.czi.technology/
Reviewers
Functional:
@seve
Readability:
@MDunitz
Changes
_app.tsx
and_document.tsx
per Nextjs for adding global stylesheets and other global stuffnext/head
for modifyingpage.title
instead ofreact-helmet
@reach/router
and use Nextjs's own router for prefetching pages doctheme-ui
8000
to3000
. However, Jessica did say that rdev prod build still needs to run on:9000
for historical reasons 🙆♂️/pages
next/image
for Image optimization