Skip to content

fix(mobile): also ping last_active_at on initial app open#14477

Merged
dylanjeffers merged 3 commits into
mainfrom
fix/mobile-ping-on-first-open
Jun 16, 2026
Merged

fix(mobile): also ping last_active_at on initial app open#14477
dylanjeffers merged 3 commits into
mainfrom
fix/mobile-ping-on-first-open

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

Summary

  • useActivityPing relied solely on useEnterForeground (an AppState.addEventListener('change') wrapper), which only fires on state transitions
  • On first launch the app starts in active with no transition, so the last_active_at ping was never sent until the user backgrounded and re-opened the app
  • Added a useEffect that fires the ping immediately on mount (when the user is logged in), so first-open is now covered alongside subsequent foreground transitions

Test plan

  • Fresh app launch with a logged-in user — verify last_active_at is updated on the identity service
  • Background + foreground the app — verify the ping still fires on re-entry
  • Launch while logged out, then sign in — verify no errors from the early mount (guard on currentUserId prevents the call)

🤖 Generated with Claude Code

dylanjeffers and others added 2 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>
@changeset-bot

changeset-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c661b6a

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.

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

# Conflicts:
#	packages/mobile/src/hooks/useActivityPing.ts
@dylanjeffers dylanjeffers merged commit 0f000be into main Jun 16, 2026
1 check passed
@dylanjeffers dylanjeffers deleted the fix/mobile-ping-on-first-open 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