feat: setUser/clearUser for post-init identity binding (v0.5.0) #28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/set-user"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Adds
setUser()andclearUser()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.userMetawas frozen at init time, soreporter_emailwas always null on SDK-submitted bugs.Fix
userMetais now a mutable instance property (initialized from config, updated via methods)setUser(user)— call after login with{ email, name }clearUser()— call on logoutbuildReport()reads from the mutable field at report timeClient app integration (5 lines)
Version
0.4.0 -> 0.5.0
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).