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

Framework: Add support for logged in isomorphic layout rendering #6312

Closed
wants to merge 1 commit into from

Conversation

aduth
Copy link
Contributor

@aduth aduth commented Jun 24, 2016

Related: #6311
Related: Isomorphic Routing

Note: This is in-progress and may not be mergeable in the near future, depending on how much <Layout /> is tied to the presence of a DOM

This pull request seeks to add support for makeLayout to be used in rendering client-side logged-in screens. These are pieces from an initial approach in #6311.

Few notes on what remains:

  • There are warnings when navigating away from a screen that uses this approach, since those other screens call ReactDom.render on an element initially rendered by React when using makeLayout. I suppose this is expected and is indicative of the work we need to do to move away from direct rendering.
  • I expect there's cases where we have logged in server-side rendered pages? In those cases, require( 'layout' ); will probably bomb because of all the DOM-dependent modules it uses. I suppose we'll need a SSR-ready logged-in layout alternative component?

/cc @ockham

Test live: https://calypso.live/?branch=update/isomorphic-routing-logged-in


return props;
};
} )();
Copy link
Member

Choose a reason for hiding this comment

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

Candidate for lodash/once?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Candidate for lodash/once?

Yeah, I think once would be a perfect fit here.

@ockham
Copy link
Contributor

ockham commented Jun 27, 2016

Great to see some interest and progress on this. Here's an earlier attempt of mine that has some discussion on issues we were running into at the time, some of which might have hopefully been resolved by React 15.

@ockham
Copy link
Contributor

ockham commented Jun 27, 2016

  • There are warnings when navigating away from a screen that uses this approach, since those other screens call ReactDom.render on an element initially rendered by React when using makeLayout. I suppose this is expected and is indicative of the work we need to do to move away from direct rendering.

Yeah, and those warnings tended to go hand in hand with actual rendering errors when we last tried such a thing with #5081. I was starting to get concerned we might only be able to switch over to single tree rendering in one big sweep across all sections, but I'd love to be proven wrong. We should pay particular attention to switching across different sections and groups with any PR that attempts such a thing tho. Litmus test is /start, available to client-side routing for logged in users through my-site's site switcher, 'Add New Wordpress'.

  • I expect there's cases where we have logged in server-side rendered pages?

Not yet. This is partly due to performance and caching concerns. Since we were wary about renderToString locking up node for more complex pages, we decided to cache the markup obtained from it. In order to not fill up that cache too quickly, we only SSR themes for logged-out users (and hence, search engines).

In those cases, require( 'layout' ); will probably bomb because of all the DOM-dependent modules it uses. I suppose we'll need a SSR-ready logged-in layout alternative component?

Later on, yeah, but we might be able to do without for now.

@ockham
Copy link
Contributor

ockham commented Jul 26, 2016

@aduth I've rebased and updated #5081, and I think it's a functional PoC (single-tree rendering logged-in /design) now. Sorry for the involuntary competition, I didn't mean it to be that -- it was just a bit easier to build upon my own work since I still had in mind what was left to be done there. Would appreciate your comments.

@aduth
Copy link
Contributor Author

aduth commented Jul 28, 2016

Sorry for the involuntary competition, I didn't mean it to be that

Heh, certainly not offended. As I mentioned before, the changes here were simply remnants of an initial approach from an earlier PR, and nowhere near ready to be merged. I'll go ahead and close this in favor of yours.

@aduth aduth closed this Jul 28, 2016
@aduth aduth deleted the update/isomorphic-routing-logged-in branch July 28, 2016 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants