 React = require 'react'
 talkClient = require 'panoptes-client/lib/talk-client'
 {Link} = require 'react-router'
-PromiseRenderer = require '../components/promise-renderer'
 
 module.exports = React.createClass
   displayName: 'TalkBreadcrumbs'
+  
+  getInitialState: ->
+    board: null
+    discussion: null
+  
+  componentWillMount: ->
+    @updateBoard @props.params.board
+    @updateDiscussion @props.params.discussion
+  
+  componentWillReceiveProps: (newProps) ->
+    @updateBoard newProps.params.board if newProps.params.board isnt @props.params.board
+    @updateDiscussion newProps.params.discussion if newProps.params.discussion isnt @props.params.discussion
 
   contextTypes:
     router: React.PropTypes.object.isRequired

      "/projects/#{owner}/#{name}/talk"
    else
      "/talk"

  render: ->
    params = @props.params
    onBoard = params.board?
    onDiscussion = onBoard and params.discussion?
    onRecents = @props.route.path.match /\/talk\/recents/

    <div className="talk-breadcrumbs">

          </span>}

        {if onBoard
          <span>
            {if onDiscussion
              <span>
                {@boardLink @state.board}
                <span>&nbsp;>&nbsp;{@state.discussion?.title}</span>
              </span>
            else if not onDiscussion and not onRecents
              <span>{@state.board?.title}</span>}
            {if onRecents
              <span>
                {@boardLink @state.board}
                <span>&nbsp;>&nbsp;Recents</span>
              </span>}
          </span>
        else if onRecents
          <span>&nbsp;>&nbsp;Recents</span>}
      </div>
