 module.exports = React.createClass
   displayName: 'EditProjectPageWrapper'
 
-  mixins: [TitleMixin, HandlePropChanges, PromiseToSetState]
+  mixins: [TitleMixin]
 
-  title: ->
-    "Edit #{@state.project?.display_name ? '(Loading)'}"
+  title: 'Edit'
 
   getDefaultProps: ->
-    params: null
-
-  getInitialState: ->
-    project: null
-
-  propChangeHandlers:
-    'params.projectID': 'fetchProject'
-
-  componentDidMount: ->
-    auth.listen 'change', @fetchProject
-
-  componentWillUnmount: ->
-    auth.stopListening 'change', @fetchProject
-
-  fetchProject: (_, props = @props) ->
-    @promiseToSetState project: auth.checkCurrent().then ->
-      apiClient.type('projects').get props.params.projectID
+    params:
+      projectID: '0'
 
   render: ->
-    if @state.project?
-      <ChangeListener target={@state.project}>{=>
-        <EditProjectPage {...@props} project={@state.project} />
-      }</ChangeListener>
-    else
-      <div className="content-container">
-        {if @state.rejected.project?
-          <code>{@state.rejected.project.toString()}</code>
-        else
-          <code>Loading</code>}
-      </div>
+    getProject = auth.checkCurrent().then =>
+      apiClient.type('projects').get @props.params.projectID
+
+    <ChangeListener target={auth} handler={=>
+      <PromiseRenderer promise={getProject} pending={=>
+        <p className="form-help">Loading project</p>
+      } then={(project) =>
+        @_project = project
+        <EditProjectPage {...@props} project={project} />
+      } catch={(error) =>
+        <p className="form-help error">{error.toString()}</p>
+      } />
+    } />

            }</PromiseRenderer>
          </li>
        </ul>
        <button type="button" className="minor-button" onClick={@deleteProject}>Delete this project <LoadingIndicator off={not @state.deletionInProgress} /></button>{' '}
        {if @state.deletionError?
          <div className="form-help error">{@state.deletionError.message}</div>}
      </div>
      <div className="column">
        <RouteHandler {...@props} />
      </div>
    </div>


EditProjectPage = React.createClass
  displayName: 'EditProjectPage'

  mixins: [TitleMixin, Navigation]

  title: ->
    @props.project.display_name

  getDefaultProps: ->
    project: id: '2'
