 
 
   destroy: =>
-    @navigated = true
-
     for own _name, component of @components
       for target in component.targets
         continue if target.dataset.reactTurbolinksLoaded != '1'


export class ReactTurbolinks
  constructor: (@components = {}) ->
    @navigated = false
    @targets = []
    $(document).on 'turbolinks:load', @destroyPersisted
    $(document).on 'turbolinks:load', @boot
    $(document).on 'turbolinks:before-cache', @destroy


  boot: =>
    for own _name, component of @components
      for target in component.targets
        continue if target.dataset.reactTurbolinksLoaded == '1'



  destroyPersisted: =>
    ReactDOM.unmountComponentAtNode(target) while target = @targets.pop()


