-
Notifications
You must be signed in to change notification settings - Fork 71
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
Feat/reduce bundle size #106
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #106 +/- ##
==========================================
+ Coverage 76.80% 78.61% +1.80%
==========================================
Files 55 38 -17
Lines 1341 1230 -111
Branches 155 141 -14
==========================================
- Hits 1030 967 -63
+ Misses 275 235 -40
+ Partials 36 28 -8
Continue to review full report at Codecov.
|
I had done a bad glob pattern, but a later commit fixes it. |
src/components/pages/NoMatch.js
Outdated
|
||
export default () => ( | ||
<div className="no-match"> | ||
<h1>404</h1> |
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.
Really cool 404 page 😊
@@ -4,7 +4,7 @@ | |||
"private": true, | |||
"dependencies": { | |||
"@testing-library/jest-dom": "^4.2.4", | |||
"@testing-library/react": "^9.3.2", | |||
"@testing-library/react": "^10.4.4", |
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.
Thanks for bumping this up 👍 💯
The problem I have with this is that, I notice that ever time I switch back and forth from the landing page to a page with a plot, it reloads the plot (for a second or two). The current behavior:At the beginning (when you visit the site), it takes a while to load, but once it is loaded, whenever you switch to any page, there is no wait time. This new behavior:Switching between any page with a plot is extremely fast, but if I accidentally visit the landing page again, I have to reload the plot again. I think it shouldn't have to reload the plot again... What do you think? |
src/App.js
Outdated
@@ -115,34 +116,26 @@ class App extends React.Component { | |||
* * * * * * * * * * * * * */ | |||
|
|||
render() { | |||
const { plot, ...rest } = this.state | |||
const routeProps = { |
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.
Could there be a better way to structure this than pushing about 15 props on route?
Maybe using contexts ?
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.
Yes, I actually a branch where I've built the Provider pattern, so that'll come up next.
I just needed to understand correctly which pieces of state are running through the App. For instance in that branch I have it divided as hexapod params, plot data, and the rest of settings. And that results in 3 context providers.
Edit
Forgot to say here that the main reason I did this strange props arrangement was to keep the render method under 25 lines and pass the code checks.
58921fe
to
429a4a9
Compare
With all the changes now done, I started to use the HTML attribute hidden, which is the pretty much the same as using Now the site will load fast, and in the background it'll be downloading and rendering the See how it works now :D |
src/components/Nav.js
Outdated
|
||
const Nav = () => <NavBullets /> | ||
const Nav = React.memo(() => <NavBullets />) |
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.
Thanks for using React.memo
in Nav
😄
Great! Do you think the plot should also be hidden in the I'm thinking about using profiler to measure the performance gains of your changes 😃 |
There should be some gains. Here's an article I wrote somw time ago about using these tricks :) I am actually not sure about what the 404 page should show. Up to you ^^ |
Found and fixed a bug. Needed to update |
Thanks for sharing! I'll read it! (And also your other articles) Instead of displaying a 404 page, shouldn't we just redirect to the landing page? Also, just a heads-up I'm implementing a walking gait page Also, I'm moving |
Alright, I think it should be fine in this case.
Oh that sound amazing 😮
Sweet! less global state is always welcomed |
I have not added the 404 Redirect back to room and merged master into this branch. Please do check that the Walking Gait is working as expected 😄 Gonna try to fix the issues throughout the day. |
cbdde42
to
c077bf2
Compare
Had to use the hooks -> render props -> HoCs pattern architecture to remove about 7 code climate issues, now there's only two regarding params injected to some of the routes. I might fix it today. The walking animations looks AMAZING! 🎉 |
Please do take your time and do not rush or hurry. Thanks for all your time, effort and all your hard work! |
src/App.js
Outdated
<Routes {...routeProps} onPageLoad={this.onPageLoad} /> | ||
</Route> | ||
<Route> | ||
<Redirect to="/" /> |
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.
💯 👍
Ah :D I think this PR is ready for some serious merging considerations 💯 |
This PR tries to implement #55 :)
It introduces a bunch of refactoring of Routes, removes
React-Markdown
, applies React features such as lazy loading + Suspense and Webpack dynamic imports.Today navigating to an invalid Route, renders a table with a bunch of zeroes. This takes care of it.
I know one should squash commits, we can do that, but would be nice to discuss the PR first. The commits list helps follow how the feature evolved.
I also needed to merge master, we should make sure things are alright.
Cheers!