Skip to content

feat(web): ping last_active_at on page load and tab focus#14478

Merged
dylanjeffers merged 4 commits into
mainfrom
feat/web-ping-last-active-at
Jun 16, 2026
Merged

feat(web): ping last_active_at on page load and tab focus#14478
dylanjeffers merged 4 commits into
mainfrom
feat/web-ping-last-active-at

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

Summary

  • Adds a useActivityPing hook to the web app that POSTs to /v1/users/me/ping on page load and when the tab regains visibility (visibilitychange)
  • Reuses the existing audiusBackendInstance.pingActivity method (same as mobile) for signing and encoding
  • Debounces pings to at most once per 5 minutes to avoid spamming the endpoint
  • Wired into WebPlayer so it fires for all logged-in users

Test plan

  • Log in to the web app and verify a POST to /v1/users/me/ping fires on page load
  • Switch to another tab and back — verify the ping fires again (if >5 min elapsed)
  • Rapidly switch tabs — verify debounce prevents multiple pings within 5 minutes
  • Verify no ping fires when logged out

🤖 Generated with Claude Code

dylanjeffers and others added 3 commits June 15, 2026 16:16
Adds a pingActivity backend function and useActivityPing hook that fires
POST /v1/users/me/ping each time the mobile app enters the foreground,
recording the user's last app-open for inactivity notifications.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AppState.addEventListener('change') only fires on state transitions.
On first launch the app starts in 'active' with no transition, so the
ping was never sent until the user backgrounded and re-opened the app.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6725b0d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dylanjeffers dylanjeffers enabled auto-merge (squash) June 16, 2026 19:07
Resolve conflict in useActivityPing.ts — keep the fix (useEffect for
initial mount ping).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pull-request-size pull-request-size Bot added size/M and removed size/L labels Jun 16, 2026
@dylanjeffers dylanjeffers merged commit 129a5f6 into main Jun 16, 2026
1 check passed
@dylanjeffers dylanjeffers deleted the feat/web-ping-last-active-at branch June 16, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant