etcet / HNES

Hacker News Extension Suite
Other
248 stars 71 forks source link

Preserve collapsed comments #84

Closed ibejoeb closed 9 years ago

ibejoeb commented 9 years ago

I'd like to be able to preserve the state of the comments page between reloads. I collapse the threads that I don't want to see anymore.

I have implemented a basic persistent collapsed state. Should anyone be interested, I will push to my fork for review. There are some design considerations that arise:

  1. What is the expiration policy of the state objects in localstorage?
  2. How is one notified of new comments within collapsed threads? I support extending the existing CommentTracker to add an indicator on the topmost visible parent. (I think this is a generally useful design enhancement even outside of the collapsible feature.)

During the implementation, it turned out to be easier to have an abstract model of the thread. I build a comment graph during init() and use that to drive the UI changes. This is likely to be useful for implementing other comment-related features.

ibejoeb commented 9 years ago

completed in #98