 
   componentDidUpdate: (prevProps, prevState) ->
     if prevState.currentUrl != @state.currentUrl
+      return
       console.log 'was', prevState.currentUrl
       console.log 'now', @state.currentUrl
 

    history.replaceState obj, '', window.location

    unless @props.isUser == false
      console.log 'isUser', @props.isUser
      @socket = @getSocket 'kerplunk'
      @socket.on 'data', (data) =>
        return unless @isMounted()
        if data.state?
          console.log 'set state', data.state
          @setState data.state

    window.addEventListener 'popstate', (e) =>
      console.log 'popstate', history.state
      newState = history.state
      unless newState and Object.keys(newState ? {}).length > 0
        newState = obj

      return
    if navigable
      e.preventDefault()
      return
    #if force == true
    # console.log 'fetch data to populate component', e
    e.preventDefault()
    @setState
      contentComponent: @props.globals.public.loadingComponent
    return false unless url

    handleData = (data) =>
      historyState = _.extend {}, data.state,
        currentUrl: url
        contentComponent: data.component
      if data.title
        document.title = data.title
        historyState.title = data.title
      history.pushState historyState, url, url
      if data.state.data?[0]?._id
        for item in data.state.data
          @props.Repository.update item._id, item
      newState = _.extend {}, data.state,
        contentComponent: data.component
        currentUrl: url
        title: data.state.title ? defaultTitle
      document.title = newState.title
      # console.log 'data received, show component', newState
      @setState newState

    if data?
      handleData data
      return
    jsonUrl = "#{url}.json"
    @props.request.get jsonUrl, null, (err, data) =>
      if err or !data?.component or !data?.state
        return window.location = url
      handleData data

  sockets: {}
  getSocket: (socketName, obj = {}) ->
