Skip to content

Conversation

@alltheseas
Copy link
Contributor

@alltheseas alltheseas commented Dec 28, 2025

Summary

Fixes #1225 - unfollowed accounts still showing up in feed.

The root cause was that timeline filters were built once from the contact list and never updated when users followed/unfollowed accounts. The profile page correctly showed the updated follow state because it queries the live ContactState, but the timeline kept using the stale filter.

Changes

Commit 1: filter: add contact_list_timestamp tracking to FilterStates

  • Add contact_list_timestamp field to track when filter was built
  • Add invalidate() method to reset filter states for rebuild

Commit 2: timeline: add reset methods for subscription and view cleanup

  • TimelineSub::reset(): Properly unsubscribes from ndb/relay pool before resetting
  • TimelineTab::reset(): Clears cached notes and resets virtual list
  • Timeline::reset_views(): Resets all view tabs

Commit 3: timeline: rebuild filter when contact list changes

  • Add contact_list_needs_rebuild() helper to detect stale filters
  • Modify is_timeline_ready() to check for contact list changes
  • Store timestamp when filter is built
  • Add #[profiling::function] for performance monitoring

Test plan

  • Follow a new account, verify their notes appear in feed
  • Unfollow an account, verify their notes are removed from feed
  • Verify no subscription leaks (check logs for proper unsubscribe messages)
  • Profile with puffin to verify no performance regression

🤖 Generated with Claude Code

e and others added 2 commits December 28, 2025 09:39
Add infrastructure to track when a contact list filter was built,
enabling detection of stale filters after follow/unfollow actions.

Changes:
- Add `contact_list_timestamp` field to FilterStates
- Add `invalidate()` method to reset filter states for rebuild

This is preparatory work for fixing damus-io#1225 where unfollowed accounts
still appear in the feed because the timeline filter is not rebuilt
when the contact list changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: e <e@*.lan>
Signed-off-by: alltheseas
Add methods to properly reset timeline state when filters need to be
rebuilt (e.g., after follow/unfollow actions).

Changes:
- TimelineSub::reset(): Unsubscribes from ndb and relay pool before
  resetting state. Preserves depender count for reference counting.
- TimelineTab::reset(): Clears cached notes and resets virtual list.
- Timeline::reset_views(): Resets all view tabs.

These methods ensure no subscription leaks when rebuilding timelines,
and that stale notes from unfollowed accounts are cleared.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: e <e@*.lan>
Signed-off-by: alltheseas
Closes damus-io#1225

Fixes damus-io#1225 - unfollowed accounts still showing up in feed.

The root cause was that timeline filters were built once from the
contact list and never updated when users followed/unfollowed accounts.

Changes:
- Add `contact_list_needs_rebuild()` helper to detect stale filters
- Modify `is_timeline_ready()` to check for contact list changes and
  trigger filter rebuild when detected
- Store contact list timestamp when filter is built
- Add `#[profiling::function]` attribute for performance monitoring

The rebuild flow:
1. Detect timestamp mismatch between filter and current contact list
2. Invalidate filter states (reset to NeedsRemote)
3. Clear cached notes from views
4. Reset subscription (properly unsubscribing first)
5. Fall through to normal filter build path

Code follows nevernesting pattern with early returns and extracted
helper function for readability.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: e <e@*.lan>
Signed-off-by: alltheseas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unfollowed accounts still show up in feed.

1 participant