     project: null
     owner: null
     preferences: null
+    loading: false
 
   getInitialState: ->
     background: null

          <IndexLink to="#{projectPath}" activeClassName="active" className="tabbed-content-tab" onClick={logClick?.bind this, 'project.nav.home'}>
            {if @state.avatar?
              <img src={@state.avatar.src} className="avatar" />}
            {@props.project.display_name}
          </IndexLink>}

        {unless @props.project.redirect

    if pathChanged or userChanged
      @fetchProjectData owner, name, nextProps.user

  fetchProjectData: (ownerName, projectName, user) ->
    @listenToPreferences null
    @setState
      loading: true
      error: null
      preferences: null

    slug = ownerName + '/' + projectName

    apiClient.type('projects').get {slug}
      .then ([project]) =>
        @setState {project}

        if project?
          awaitOwner = project.get 'owner'
            .then (owner) =>
              @setState {owner}

          awaitPreferences = if user?
            user.get 'project_preferences', project_id: project.id
              .then ([preferences]) =>
                preferences ? newPreferences = apiClient.type('project_preferences').create({
                  links: {
                    project: project.id
                  },
                  preferences: {}
                }).save()
          else
            Promise.resolve apiClient.type('project_preferences').create
              id: 'GUEST_PREFERENCES_DO_NOT_SAVE'
              links:
                project: project.id
              preferences: {}

          awaitPreferences = awaitPreferences.then (preferences) =>
            @listenToPreferences preferences
            @setState {preferences}

          Promise.all [awaitOwner, awaitPreferences]

        else
          this.setState
            owner: null,
            preferences: null
            error: new Error 'NOT_FOUND'

      .catch (error) =>
        @setState {error}
