Skip to content

Deleted archived task reappears in sidebar until workspaces cache refreshes #3143

Description

@igennova

Deleted archived task reappears in sidebar

Summary

When a task is deleted from the Archived tasks view, it reappears in the sidebar task list. The task should remain hidden after deletion.

Steps to reproduce

  1. Create or select an existing task in the sidebar.
  2. Right-click the task → Archive.
  3. Open the Archived tasks view (Home → Archived → “View all”, or /code/archived).
  4. Delete the archived task (Delete button or context menu → Delete).
  5. Observe the sidebar task list.

Expected behavior

  • The deleted task does not appear in the sidebar.
  • The task does not appear in other task lists that respect workspace/archive state.

Actual behavior

  • After deleting from Archived tasks, the task reappears in the sidebar.
  • It may disappear later after an unrelated refresh (navigation, restart, or another action that refetches workspaces).

Screen recording

Screen.Recording.2026-07-04.at.12.19.40.PM.mov

Environment

  • App: PostHog Code (desktop)
  • Mode: local
  • OS: macOS

Suspected cause

Deleting an archived task removes local state on the server (archives row + workspaces row), but the UI refresh after delete only invalidates archive and tasks caches — not the workspaces cache.

Sidebar visibility requires both:

  • Task is not archived (archivedTaskIds)
  • Task has a workspace (workspaces)

After delete:

Cache After refetch Result
archivedTaskIds No longer archived ✅ Updated
workspaces Still has workspace ❌ Stale

Because !archived && hasWorkspace evaluates to true, the task shows in the sidebar again.

Restore (unarchive) already invalidated the workspaces cache; delete did not.

Proposed fix

After a successful archived-task delete, also invalidate WORKSPACE_QUERY_KEY, matching the restore path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions