title: Ko.computed function updates twice
body: <p>Due to data being loaded via AJAX I need my data to be updated when data arrives.</p>
  
  <p>On page load I collect projects in database. Then load data for Tasks and Tags depending on which project is selected (self.SelectedProject). </p>
  
  <pre><code>self.Projects = ko.observableArray();
  self.Tasks = ko.observableArray();
  self.Tags = ko.observableArray();
  self.SelectedProject = ko.observable();  // Chosen Project-object...
  </code></pre>
  
  <p>For initialization I load data for the first Project:</p>
  
  <pre><code>self.SelectedProject(self.Projects()[0]);          // Choose first returned Project... 
  </code></pre>
  
  <p>Then I go on to populate my tag-helping arrays:</p>
  
  <pre><code>ko.computed(function () {  
      // must be ko.computed as else will not update when data arrives for Tags and Tasks (which are likely to be empty at load time)...
  
      // Empty projectAvailableTags before refill...
      self.SelectedProject().projectAvailableTags([]);
  
      // First populate current project's "projectAvailableTags"-array with values...
      for (var j = 0, jlen = self.Tags().length; j &lt; jlen; j++) {
          self.SelectedProject().projectAvailableTags().push(self.Tags()[j].TagName());
      }
  
      for (var i = 0, ilen = self.Tasks().length; i &lt; ilen; i++) {
          //---- Populate each TaskTag-array with Tags...
          for (var j = 0, jlen = self.Tags().length; j &lt; jlen; j++) {
              if (self.Tags()[j].TagTaskId() === self.Tasks()[i].TaskId) {
                  self.Task()[i].TaskTags.push(self.Tags()[j]);
                  // Populate the different tag-Arrays...
                  var tagtype = self.Tags()[j].TagType;
                  switch (tagtype()) {
                      case 0: self.Tasks()[i].Location().push(self.Tags()[j].TagName()); break;
                      case 1: self.Tasks()[i].Manager().push(self.Tags()[j].TagName()); break;
                      case 2: self.Tasks()[i].Employee().push(self.Tags()[j].TagName()); break;
  
                  }
              }
          }
  
      };
  });
  </code></pre>
  
  <p>This probably look strange and maybe I am doing it unnecessarily complicated.
  I use  <a href="http://aehlke.github.com/tag-it/" rel="nofollow">http://aehlke.github.com/tag-it/</a> as tag manager and it needs an array with TagNames only. Thus I haven´t figured out how to use the Tags()-array directly although I´d like that.</p>
  
  <p>Tasks are presented in an accordion, and I want the Task-tags to be applied in the content panel, while I use my Project-tags as the tagSource for autocomplete-functionality...</p>
  
  <p>But I cannot figure out why my tags are applied 2 times with the ko.computed while they aren´t applied unless I reselect the project without it.</p>