feat: setUser/clearUser for post-init identity binding (v0.5.0) #28

Merged
john merged 1 commit from feat/set-user into dev 2026-06-17 10:16:22 +00:00
Owner

What

Adds setUser() and clearUser() methods to the BugReporter class, allowing client apps to bind user identity after initialization (when auth context resolves).

Problem

initBugReporter() runs at module load — before React renders, before auth resolves. userMeta was frozen at init time, so reporter_email was always null on SDK-submitted bugs.

Fix

  • userMeta is now a mutable instance property (initialized from config, updated via methods)
  • setUser(user) — call after login with { email, name }
  • clearUser() — call on logout
  • buildReport() reads from the mutable field at report time

Client app integration (5 lines)

// main.tsx
export const bugReporter = initBugReporter({...})

// auth-context.tsx
useEffect(() => {
  if (user) bugReporter.setUser({ email: user.email, name: user.full_name })
  else bugReporter.clearUser()
}, [user])

Version

0.4.0 -> 0.5.0

## What Adds `setUser()` and `clearUser()` methods to the BugReporter class, allowing client apps to bind user identity after initialization (when auth context resolves). ### Problem `initBugReporter()` runs at module load — before React renders, before auth resolves. `userMeta` was frozen at init time, so `reporter_email` was always null on SDK-submitted bugs. ### Fix - `userMeta` is now a mutable instance property (initialized from config, updated via methods) - `setUser(user)` — call after login with `{ email, name }` - `clearUser()` — call on logout - `buildReport()` reads from the mutable field at report time ### Client app integration (5 lines) ```tsx // main.tsx export const bugReporter = initBugReporter({...}) // auth-context.tsx useEffect(() => { if (user) bugReporter.setUser({ email: user.email, name: user.full_name }) else bugReporter.clearUser() }, [user]) ``` ### Version 0.4.0 -> 0.5.0
feat: setUser/clearUser for post-init identity binding (v0.5.0)
All checks were successful
CI / Detect Changes (pull_request) Successful in 5s
CI / Build & Lint (pull_request) Successful in 16s
CI / Docker Build (pull_request) Successful in 35s
078732389b
Apps call reporter.setUser({ email, name }) after login resolves.
Fixes bug reports having null reporter_email because userMeta was
frozen at init time (before auth context is available).
john merged commit 1c794c34f7 into dev 2026-06-17 10:16:22 +00:00
john deleted branch feat/set-user 2026-06-17 10:16:22 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
haskytech/bug-reporter!28
No description provided.