• Randall Leeds's avatar
    Overhaul the threading, sort, and view further · 957ad49c
    Randall Leeds authored
    Lots of changes to massively simplify things and make them much more
    performant.
    
    - The thread directive gets a few changes
      - Cleared up confusing tuple unpacking in favor of named properties
        in the render queue as per the suggestion of @aron
      - The replies and annotation are set at once. Since the replies in
        turn render lazily, this should be fast enough for all but an
        unwieldy number of threads. If we hit that wall, we'll have to do
        some filtering / pagination.
      - The directive is now triggered only on attributes and parses the
        attribute value to get the thread
    - The threads are rendered from a single thread root rather than using
      a global list of annotations that must be watched for its threads to
      be extracted. This results in a huge performance gain because this
      thread container has a stable set of children.
      - When the first `annotationsLoaded` callback arrives, we set a new
        root from the result of asking the threading plugin to thread them
      - Lots of hackery during store reloads goes away because we just nuke
        the thread root and reload
    - The application controller does not have to modify a root annotation
      set at all anymore
    - Use of the root scope in the controllers goes away entirely
    - The ongoing edit is now stored in the scope again so that it can be
      be pinned to the top of the thread list
    - The editor view and controller go away completely because the top
      level edit is now pinned to the top of the list, removing the need
      to re-render annotations between editing and viewing
    - The selected annotations are now a hash of annotation ids to true
      values if the annotation is selected, or null if the selection is
      empty
    - An ng-show is used to show/hide the selected/unselected annotations,
      further reducing re-renders
    - The view state is gone complete and now there is only sort
    - The sort is not applied programmatically in the controller, but a
      simple watch on the name of the sort is used to set the predicate
      and reverse settings as scope properties that feed into an orderBy
      filter on the thread list, reducing the number of extra watches we
      have to do and further reducing the code
    - The sort is no longer an animated dropdown, but sits at the top of
      the list always (I assume we can style this better, so have at it)
    - Unnecessary helper and logging functions are removed from the
      annotator service because silence is golden
    957ad49c
annotation.coffee 7.36 KB