     error: false
     loading: false
 
-  propChangeHandlers:
-    'params.collection_owner': 'fetchCollection'
-    'params.collection_name': 'fetchCollection'
-    'user': 'fetchCollection'
+  componentWillMount: ->
+    @fetchCollection()
 
   fetchCollection: ->
     @setState
-      error: false
       loading: true
 
     apiClient.type('collections')
       .get(slug: @props.params.collection_owner + '/' + @props.params.collection_name, include: 'owner')
       .then ([collection]) =>
-        unless collection then @setState error: true
 
         apiClient.type('collection_roles')
           .get(collection_id: collection.id)
           .then (roles) =>
             @setState
+              error: false
+              loading: false
               collection: collection
               roles: roles
-      .catch =>
+      .catch (e) =>
         @setState
           error: true
-          collection: null
-      .then =>
-        @setState loading: false
+          loading: false
 
   render: ->
     classes = classNames {
       "content-container"
       "collection-page-with-project-context": @props.project?
     }
+    {project, user} = @props
     <div className={classes}>
       {if @state.collection
-        <CollectionPage {...@props} collection={@state.collection} roles={@state.roles} />}
+        <CollectionPage project={project} user={user} collection={@state.collection} roles={@state.roles}>
+          {@props.children}
+        </CollectionPage>
+      }
 
       {if @state.error
         <Translate component="p" content="collectionsPageWrapper.error" />}

React = require 'react'
apiClient = require 'panoptes-client/lib/api-client'
PromiseRenderer = require '../components/promise-renderer'
{IndexLink, Link} = require 'react-router'
Translate = require 'react-translate-component'
counterpart = require 'counterpart'
Avatar = require '../partials/avatar'
Loading = require '../components/loading-indicator'
HandlePropChanges = require '../lib/handle-prop-changes'
TitleMixin = require '../lib/title-mixin'
classNames = require 'classnames'


  getDefaultProps: ->
    collection: null

  getInitialState: ->
    owner: null

  componentWillMount: ->
    apiClient.type 'users'
      .get @props.collection.links.owner.id
      .then (owner) =>
        @setState {owner}
    
  componentDidMount: ->
    document.documentElement.classList.add 'on-collection-page'

