-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Framework: Add makeLayout
#5081
Framework: Add makeLayout
#5081
Conversation
805277e
to
cff921e
Compare
Testcase:
This is not happening on master. |
Ugh, good spot. Another point where React is apparently confused by multiple subtrees (signup's and the showcase's) rendering to |
84e8ef5
to
aa3861b
Compare
makeLayout
, don't render layout for isomorphic sections in client/boot
makeLayout
<LayoutComponent store={ store } | ||
primary={ primary } | ||
secondary={ secondary } | ||
tertiary={ tertiary } |
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 are not really using tertiary anymore, we should drop all references to it.
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.
I still see it being used in https://github.com/Automattic/wp-calypso/blob/master/client/reader/controller.js...
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.
Ugh, that should use root-child.
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.
Filed #5182.
Any ideas on how this would affect chunk loading and file size? |
AFAICT, the main change is that
This branch:
|
Subtree unmounting and reconciliation is quite a headache here, and to fix errors like #5081 (comment) we might have to force a re-render of the entire Some preliminary experiments of mine seem to indicate that React 15 is more reliable wrt to that kind of issue, so it might make sense to upgrade to that first (#5116) before spending more time tinkering with re-renders because of those pesky errors... |
a6413d8
to
058a092
Compare
This is very cool. I've been trying to break it by trying different routes, entry points, exit points, and logged in states. All work. The code looks good from an initial glance, but I'll have a more thorough look later. Could you rebase this against |
08c2e60
to
b5c21b3
Compare
Yay!
Yep, done. |
* Allow elements as props to the layout component * Add a ReduxWrappedLayout helper function * Split the entry points for the isomorphic router controller (allowing client-specific dependencies)
b5c21b3
to
f892793
Compare
import LayoutLoggedOut from 'layout/logged-out'; | ||
import nuxWelcome from 'layout/nux-welcome'; | ||
import translatorInvitation from 'layout/community-translator/invitation-utils'; | ||
import { makeLayoutMiddleware } from './index.node.js'; |
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 should go in shared.js
right? :)
Had a closer look at the code. This looks good to 🚢 . One 🌲 to rule them all! |
SSR was broken by #5081, where I flipped the check for logged-out to logged-in: https://github.com/Automattic/wp-calypso/pull/5081/files#diff-2ff5c9f67cfab8b6325e63706e3f4970R18 misses the negation that was previously present at https://github.com/Automattic/wp-calypso/pull/5081/files#diff-a3600f12cca835b2ea80190a8243a8cbL26. This PR adds it back.
SSR was broken by #5081, where I flipped the check for logged-out to logged-in: https://github.com/Automattic/wp-calypso/pull/5081/files#diff-2ff5c9f67cfab8b6325e63706e3f4970R18 misses the negation that was previously present at https://github.com/Automattic/wp-calypso/pull/5081/files#diff-a3600f12cca835b2ea80190a8243a8cbL26. This PR adds it back.
SSR was broken by #5081, where I flipped the check for logged-out to logged-in: https://github.com/Automattic/wp-calypso/pull/5081/files#diff-2ff5c9f67cfab8b6325e63706e3f4970R18 misses the negation that was previously present at https://github.com/Automattic/wp-calypso/pull/5081/files#diff-a3600f12cca835b2ea80190a8243a8cbL26. This PR adds it back.
This PR:
Layout
accept React element trees asprimary
,secondary
, andtertiary
props.client/controller
into a client and server side version.makeLayout()
to automatically renderLayoutLoggedOut
in logged-out mode, andLayout
otherwise.ReduxWrappedLayout
andReduxWrappedLoggedOutLayout
helper components.my-sites/controller
exposemakeNavigation
as a middleware that populatescontext.secondary
client/my-sites/themes
to usemakeLayout
No visual changes.
To test:
/design
, and clicking on a theme's screenshot to navigate to its details sheet.Fixes part of #2299. This is a redux of #4836, also picking up some pieces from #4820.