Skip to content

feat: sync task pins with PostHog - #3925

Merged
trunk-io[bot] merged 1 commit into
mainfrom
posthog-code/sync-task-pins
Jul 29, 2026
Merged

feat: sync task pins with PostHog#3925
trunk-io[bot] merged 1 commit into
mainfrom
posthog-code/sync-task-pins

Conversation

@tatoalo

@tatoalo tatoalo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Problem

Task pins are currently stored per device, so they cannot be recovered when a user signs back in elsewhere.

Why: The pinned-task sidebar should reflect the authenticated user, not a particular installation or browser profile.

Changes

  • add API client methods for reading and setting user task pins.
  • make unpin writes idempotent.

Depends on PostHog/posthog#74595

@tatoalo tatoalo self-assigned this Jul 29, 2026
@trunk-io

trunk-io Bot commented Jul 29, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

React Doctor could not produce a report.

Reviewed by React Doctor for commit d54dfbb.

@tatoalo
tatoalo marked this pull request as ready for review July 29, 2026 11:03
Comment thread packages/ui/src/features/sidebar/usePinnedTasks.ts Outdated
Comment thread packages/ui/src/features/sidebar/taskMetaApi.ts Outdated
@greptile-apps

greptile-apps Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
### Issue 1
packages/ui/src/features/sidebar/usePinnedTasks.ts:11-15
**Pins cache crosses identities**

When a user logs out, changes projects, or switches organizations, this static query remains cached because it lacks authentication-scoped metadata and an authentication guard. The sidebar therefore displays the previous identity's pins, or the unauthenticated empty result, for up to the 30-second stale period.

### Issue 2
packages/ui/src/features/sidebar/taskMetaApi.ts:57-61
**Concurrent toggles collapse**

When the same task is toggled twice before the first GET-and-POST sequence finishes, both operations can read the same initial pin state and write the same value. Two user actions then produce only one persisted toggle, leaving the server state inconsistent with the user's final action.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix: route sidebar pins through PostHog" | Re-trigger Greptile

@tatoalo
tatoalo force-pushed the posthog-code/sync-task-pins branch from d763943 to 2348d61 Compare July 29, 2026 11:09
Comment thread packages/ui/src/features/sidebar/usePinnedTasks.ts Outdated
@veria-ai

veria-ai Bot commented Jul 29, 2026

Copy link
Copy Markdown

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

Generated-By: PostHog Code
Task-Id: a9750a18-8013-4b1f-ab40-d9999bba7144

fix: route sidebar pins through PostHog

Generated-By: PostHog Code
Task-Id: a9750a18-8013-4b1f-ab40-d9999bba7144

perf: avoid redundant task pin reads

Generated-By: PostHog Code
Task-Id: a9750a18-8013-4b1f-ab40-d9999bba7144

fix: scope and serialize task pin state

Generated-By: PostHog Code
Task-Id: a9750a18-8013-4b1f-ab40-d9999bba7144
@tatoalo
tatoalo force-pushed the posthog-code/sync-task-pins branch from 9aecbbb to d54dfbb Compare July 29, 2026 11:19
@tatoalo
tatoalo enabled auto-merge (squash) July 29, 2026 12:35
@trunk-io
trunk-io Bot merged commit dd419cf into main Jul 29, 2026
33 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/sync-task-pins branch July 29, 2026 12:43
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.

2 participants