WordPress.org

Making WordPress.org


Ignore:
Timestamp:
07/24/2016 09:40:56 PM (3 years ago)
Author:
obenland
Message:

Plugin Directory: WordCamp Boston Contributor Day updates.

  • Separate store creation.
  • Pass SiteHeader component to React Router for navigation links to rerender.
  • Pass default plugins from container component to PluginSection.
  • Basic 404 and no-content handling.

Props sirbrillig.
See #1719.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/client/containers/page.jsx

    r3716 r3717  
     1import React, { Component } from 'react';
    12import { connect } from 'react-redux';
    23import find from 'lodash/find';
     
    56 * Internal dependencies.
    67 */
    7 import Page from 'components/page';
     8import Page from '../components/page';
     9import { getPage } from '../actions';
     10
     11class PageContainer extends Component {
     12    componentDidMount() {
     13        this.getPage();
     14    }
     15
     16    componentDidUpdate( previousProps ) {
     17
     18        if ( this.props.route.name !== previousProps.route.name ) {
     19            this.getPage();
     20        }
     21    }
     22
     23    getPage() {
     24        this.props.dispatch( getPage( this.props.route.name ) );
     25    }
     26
     27    render() {
     28        return <Page { ...this.props } />;
     29    }
     30}
    831
    932const mapStateToProps = ( state, ownProps ) => ( {
    10     page: find( state.pages, { slug: ownProps.route.path } )
     33    page: find( state.pages, { slug: ownProps.route.name } )
    1134} );
    1235
    13 export default connect( mapStateToProps )( Page );
     36export default connect( mapStateToProps )( PageContainer );
Note: See TracChangeset for help on using the changeset viewer.