Skip to content
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

Add server side rendering #853

Merged
merged 84 commits into from Mar 4, 2020
Merged

Add server side rendering #853

merged 84 commits into from Mar 4, 2020

Conversation

arielsvn
Copy link
Contributor

@arielsvn arielsvn commented Feb 11, 2020

Issue Number

#844

Purpose/Implementation Notes

This turned out to be more complicated than I was expecting, however, I'm happy with how it's coming along. I deployed a demo to https://refinebio.now.sh/

A few things are missing from this PR in order to be ready:

  • Find a solution to navigate between pages that don't rely on the URL state because NextJS doesn't support this by default.

  • Fix filters on search

  • Fix unit tests

  • Fix integration tests

  • Compendia page toggle

  • Remove all packages related to CRA

  • Add deploy configuration, we talked about Lambda@Edge. Alternatively, now.sh also integrates with Github and can deploy the app automatically.

@davidsmejia feel free to take a look, I'd really appreciate any comments. With the number of changes this includes we'll have to review it carefully.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Functional tests

Demo on https://refinebio.now.sh/

Checklist

  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

@arielsvn arielsvn changed the title WIP Add server side rendering Add server side rendering Feb 26, 2020
@arielsvn arielsvn marked this pull request as ready for review February 26, 2020 22:07
@arielsvn
Copy link
Contributor Author

@davidsmejia I checked this a couple more times, it should be ready for review. I'm going to update the readme tomorrow to reflect the nextjs changes and also want to investigate if we can improve the code splitting, right now looks like it's generating too many files.

Copy link
Collaborator

@davidsmejia davidsmejia left a comment

Choose a reason for hiding this comment

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

Dang @arielsvn great job! Some small notes but just considerations.

Great Job!

page = parseInt(page, 10);
size = parseInt(size, 10);
page = page ? parseInt(page, 10) : 1;
size = size ? parseInt(size, 10) : 10;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like it would always be a number if not passed, so will throw an error/NaN out if a non-parsable number is passed.

I think this might be a better option

maybeSize = parseInt(size, 10)
size = maybeSize > 0 ? maybeSize : 10

@@ -68,7 +68,7 @@ export function FilterCategory({
setSavedQuery(query);
onToggleFilter(queryField, filter);
}}
checked={activeValues && activeValues.includes(filter)}
checked={!!activeValues && activeValues.includes(filter)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

if you are expecting to guard against falsey values... might be nicer to:
Boolean(activeValues)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah !! has the same effect and it's used extensively in the project. I didn't know you could also do Boolean(

@@ -21,5 +24,5 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

# vim
Copy link
Collaborator

Choose a reason for hiding this comment

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

oops :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

haha not sure why that got commented out :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh it's just a header explaining the following lines... so i don't accidentally commit my swap files that are generated by vim

Copy link
Collaborator

Choose a reason for hiding this comment

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

i did not mean to add the trailing white-space though

@davidsmejia
Copy link
Collaborator

Also we should figure out previews/deploy before merging. Or at least have a roadmap in place

@arielsvn
Copy link
Contributor Author

arielsvn commented Mar 4, 2020

Talked with @davidsmejia and we came up with a plan to deploy this:

  1. Address the comments in this PR and get it merged
  2. Create a CCDL team in Zeit, and setup both staging and prod deploys under .now.sh domains
  3. On Tuesday, when I'm back, point www.refine.bio and staging.refine.bio to the ZEIT servers.
  4. Remove all frontend related terraform configuration from refinebio's backend.

@arielsvn arielsvn merged commit 1c42c1d into dev Mar 4, 2020
@arielsvn arielsvn deleted the arielsvn/844-server-side-rendering branch March 4, 2020 16:55
This was referenced Mar 4, 2020
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.

None yet

2 participants