       linkedWorkflows[randomIndex]
 
   getWorkflow: (selectedWorkflowID) ->
-    apiClient.type('workflows').get({ active: true, id: "#{selectedWorkflowID}" })
+    apiClient.type('workflows').get({ active: true, id: "#{selectedWorkflowID}", project_id: @state.project.id })
       .catch (error) =>
         console.error error
         # TODO: Handle 404 once json-api-client error handling is fixed.

        @listenToPreferences preferences
      )

  getSelectedWorkflow: (project = @state.project, preferences = @state.preferences) ->
    @setState({ loadingSelectedWorkflow: true })
    # preference workflow query, then user selected workflow, then project owner set workflow, then default workflow
    # if none of those are set, select random workflow


  componentWillUpdate: (nextProps, nextState) ->
    if nextProps.location.query?.workflow? and @canFetchWorkflowByQuery(nextProps.project, nextProps.user)
      @getSelectedWorkflow(nextState.project, nextState.preferences) unless nextState.loadingSelectedWorkflow

    if nextState.preferences?.preferences?.selected_workflow? and @state.workflow?
      if nextState.preferences?.preferences.selected_workflow isnt @state.workflow.id
        @getSelectedWorkflow(nextState.project, nextState.preferences) unless nextState.loadingSelectedWorkflow

  componentWillUnmount: ->
    Split.clear()
