       .then (pages) =>
         @setState {pages}
 
+  getSelectedWorkflow: (project, preferences) ->
+    @setState selectedWorkflow: 'PENDING'
+
+    preferredWorkflowID = preferences?.preferences.selected_workflow ? project.configuration?.default_workflow
+    if preferredWorkflowID?
+      apiClient.type('workflows').get preferredWorkflowID
+        .then (workflow) =>
+          if workflow.active
+            @setState selectedWorkflow: workflow
+          else
+            @setState selectedWorkflow: null
+    else
+      @setState selectedWorkflow: null
+
   _lastSugarSubscribedID: null
 
   updateSugarSubscription: (project) ->

  componentWillReceiveProps: (nextProps) ->
    if nextProps.project isnt @props.project
      @fetchInfo nextProps.project
      @updateSugarSubscription nextProps.project

  fetchInfo: (project) ->
    @setState

    background: null
    avatar: null
    pages: []
    selectedWorkflow: null

  componentDidMount: ->
    document.documentElement.classList.add 'on-project-page'
    @fetchInfo @props.project
    @getSelectedWorkflow @props.project, @props.preferences
    @updateSugarSubscription @props.project

  componentWillUnmount: ->
