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

Feature/single page app #3585

Merged
merged 32 commits into from
Sep 13, 2018
Merged

Feature/single page app #3585

merged 32 commits into from
Sep 13, 2018

Conversation

edbrett
Copy link
Contributor

@edbrett edbrett commented Sep 12, 2018

Overview

"Do you like big PRs? Because refactoring is how you get big PRs." - me 🥇

NOTE: to run this branch you will need to forgot everything you thought you knew about running branches [in GFW]. I highly recommend that you stop what your doing and run yarn. Then 🙏 . Then run yarn start. This isn't a game.

Up until now GFW has operated on a fairly bare bones webpack and development environment due to the need for creation of isolated react pages within the app. With the new map coming along nicely, we likely now want to merge this all onto a single react router AND start code splitting this react app for better performance. So I have gone and done it, or at least started it.

This first round of refactoring includes:

  • Single react app pack and router for the main application
  • A header pack for embedding the header in backbone pages
  • A map pack for adding the recent imagery feature to the old map with introducing breaking changes
  • CODESPLITTTTTTTING & WEBPACK 🔢 . Thanks to some dope help from @sorodrigo and @j8seangel we now have super excellently brilliant code splitting across the app. This includes splitting by page using react-universal-component and also splitChunks to split and cache our node_modules are vendors. Quite the improvement.
  • Remove redis from the dev environment to help keep everyone sane when looking at their console.
  • Introduced the vizzuality redux-tools for a more efficient and consistent actions workflow.
  • Exported all { actions, reducers, initialsState } as reduxModule to assist in reducing code splitting page pack sizes.
  • Use react-universal-component to handle dynamic importing of page packs inside the layouts/root component.

CAVEATs:

  • The folder structure of app/javascript has been maintained for now until we merge this branch with develop. This is to make building on staging easier. Once it has been merge then we can move all components etc inside the app folder.
  • We only have the react links in the header of the map. As the common header is isolated across pages I thought it best not to make that change yet. When the map goes to production we can add this pack to the head of all pages.
  • SEO and metadata is not yet handled on a single rails controller due to the time needed to set it up. Similar to the header comment above. As we have controllers and entry points for each page there is no rush to sort this until we start using NavLink components to move between views.

Demo

Too many things. Pull and start.

Testing

  • View all react end points and make sure they render (v2/map, about, small-grants-fund, map, dashboards)

Copy link
Contributor

@benlaken benlaken left a comment

Choose a reason for hiding this comment

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

Works locally, and I can't seem to break it. 👍

@edbrett
Copy link
Contributor Author

edbrett commented Sep 13, 2018

If there are no issues I am going to merge :).

@edbrett edbrett merged commit 2ec16ce into feature/map-v2 Sep 13, 2018
@edbrett edbrett deleted the feature/single-page-app branch September 13, 2018 17:08
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.

3 participants