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

Enable SSR #2017

Merged
merged 63 commits into from
Apr 7, 2021
Merged

Enable SSR #2017

merged 63 commits into from
Apr 7, 2021

Conversation

nellh
Copy link
Contributor

@nellh nellh commented Mar 27, 2021

This supersedes #1997 and includes some fixes from the review of that.

New major changes:

  • Switch to Vite for all builds, dropping Webpack
  • Additional TypeScript and eslint fixes to allow for less overrides
  • Replace useMedia with a CSS approach that's compatible with SSR called @artsy/fresnel
  • Extends openneuro-app with the SSR server (it should be its own package but it complicates things further so this is a temporary home)
  • Fixes various TypeScript project reference issues in Enable TypeScript builds for openneuro-app #1997
  • Replaces all client side cookie handling with SSR compatible (useCookies in react-cookie
  • More types as they were needed to keep TSC happy.
  • Switch to tsc-watch from ts-node in most places. ts-node/ts-node-dev seems to have some issues with project references and this is only a little slower.
  • Disables code splitting because @loadable/component is only working with Webpack and React.lazy does not work in server mode without ugly hacks. Vite is improving this so we can likely turn it back on once upstream fixes arrive.
  • Warming the Apollo Client cache on SSR page loads to get rendered queries without JavaScript without the extra re-render after load with JavaScript.

This requires using the dev branch of bids-validator and merging https://github.com/bids-standard/bids-validator/pull/1238

It also depends on a change in Vite to support classic web workers. We need classic workers for Firefox support for bids-validator. This requires some workarounds that I'll break out from this PR

One final note, for testing with SSR try disabling JavaScript. You should be able to click anything which is a real href and have the routes load. Some are visually compromised without JavaScript (the dashboard page) but should work well enough for search indexing.

nellh added 30 commits March 1, 2021 20:29
Configures tsconfig for project wide builds.
This requires a refactor to be type safe but it works well enough for now.
This fixes the DropdownButton component and drops another dep on react-bootstrap.
true generates sourcemaps that most tools can find automatically.

External just generates the map.
@nellh
Copy link
Contributor Author

nellh commented Mar 29, 2021

Looks like CI just needs to be updated for tests, they should pass locally. I'm working on the CI issue.

Copy link
Contributor

@david-nishi david-nishi left a comment

Choose a reason for hiding this comment

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

It looks like the metadata from the upload form isn't being saved, but otherwise this looks great.

Tested:


- Yarn tests passing

  • Front page:
    • Queried data
    • Login
    • Logout
    • Admin nav item
    • Support nav item and its function
    • Responsive layout
  • Admin page
  • My Dashboard (my and saved datasets) & Public Dashboard
    • Has expected datasets
    • Search
    • Filters
    • Sorters
    • Responsive layout
  • Upload & Download
    • validator runs properly
    • metadata is saved (issue)
    • defacing/authorization is required
  • Dataset Page
    • Has expected:
      • data
      • snapshots
      • git hash
      • validator warnings
    • Readme and description edits
    • File and directory deletions
    • File and directory uploads
    • File viewers (text, json, nifti)
    • File updates
    • Edits to draft are validated immediately
    • Snapshots
    • Draft head reset
    • Publish dataset
    • Remote reexports
    • Adds metadata
    • Comments (add, reply, delete)

@nellh nellh requested a review from david-nishi April 7, 2021 22:30
@nellh
Copy link
Contributor Author

nellh commented Apr 7, 2021

Looks like the metadata issue is older than this branch but I went ahead and fixed it.

@david-nishi
Copy link
Contributor

Just a snapshot needs updating, but otherwise good to go.

@nellh nellh merged commit 0eea599 into master Apr 7, 2021
nellh added a commit that referenced this pull request Apr 9, 2021
nellh added a commit that referenced this pull request Apr 9, 2021
nellh added a commit that referenced this pull request Apr 9, 2021
tranttommy added a commit that referenced this pull request Apr 21, 2021
fix(cli): Incorrect auth headers and stream type changes from #2017
@nellh nellh deleted the ssr-enable branch December 18, 2021 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants