 
     # Template accessor that avoids data-loading race
     @getTemplate = ko.computed =>
-      @siteActive().template ? {} # Needs .template?() if @siteNav is mapped
+      @siteActive()?.template ? {} # Needs .template?() if @siteNav is mapped
 
     # Preload data
-    @getMappedData "http://roush.propter.net:8080/nodes/1/tree", @wsItems, mapping
+    @getMappedData "http://roush.propter.net:8080/nodes/1/tree", @wsTemp, mapping, =>
+      console.log @wsTemp()
+      #@wsItems = [@wsTemp()[0].children]
+      #@siteActive @siteNav()[0]
 
     @ # Return ourself
 

        key: (data) ->
          ko.utils.unwrapObservable data.id
        create: (options) ->
          createNode options.data

    createNode = (node) ->
      ko.mapping.fromJS
        nodes: ({n, actions: []} for n in node.children ? [] when "container" in n.facts.backends)
        actions: []
      , {}, ko.mapping.fromJS node, mapping

    @siteActive = ntrapy.selector (data) =>
      console.log "Triggered with: ", data
      switch data?.name
        when "Workspace"
          @getMappedData "http://roush.propter.net:8080/nodes/1/tree", @wsItems, mapping
    , @siteNav()[0] # Set to first by default

    @getMappedData = (url, pin, map={}, cb=null) ->


$ ->
  IndexModel = ->
    @wsTemp = ko.observableArray([])
    @wsItems = ko.observableArray([])

    # TODO: Map from data source
