Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing clearUser method on react-native #1259

Closed
ghsdh3409 opened this issue Jan 22, 2021 · 5 comments
Closed

Missing clearUser method on react-native #1259

ghsdh3409 opened this issue Jan 22, 2021 · 5 comments

Comments

@ghsdh3409
Copy link

Describe the bug

  • As an official reference document, there is clearUser method. But, after I upgrading v7, there is no clearUser.
  • Is this breaking change? If not, what should I use instead of clearUser?

Steps to reproduce

  1. Use Bugsnag.clearUser()

Environment

  • Bugsnag version: 7.6
  • React Native: 0.63.4
  • Device (e.g. iphonex): Android and iOS

Error screenshot

스크린샷 2021-01-22 오후 3 58 41

@xljones
Copy link

xljones commented Jan 22, 2021

Hey @ghsdh3409, the docs you've linked to are our legacy documents for the deprecated bugsnag-react-native package. The clearUser() method does not exist in the new React Native package.

In Bugsnag for React Native using bugsnag-js v7.3.0+, you can clear the user data though by calling Bugsnag.setUser(); without any arguments in the JS layer.

@xljones xljones closed this as completed Jan 22, 2021
@jdferreira-biai
Copy link

@xljones Thanks!

Btw, that should be added in the docs. I spent some time reading the docs looking for how to clear the user data.

@hannah-smartbear
Copy link

hannah-smartbear commented Nov 8, 2024

Hi @jdferreira-biai,

You can find information on how to clear user data using setUser in our docs here. Please let us know if you have any further questions!

@jdferreira-biai
Copy link

jdferreira-biai commented Nov 8, 2024

Hi @jdferreira-biai,

You can find information on how to clear user data using setUser in our docs here. Please let us know if you have any further questions!

@hannah-smartbear There is an issue. When I try to send null as value to the setUser function I get this type error:

Argument of type 'null' is not assignable to parameter of type 'string | undefined'. ts(2345)

Example:

import Bugsnag from '@bugsnag/js'

Bugsnag.setUser(null) // here i get the type error

I'm using @bugsnag/[email protected].

@mclack
Copy link
Contributor

mclack commented Nov 25, 2024

Hi @jdferreira-biai

Thanks for highlighting this.

This appears to be due to us enforcing the setUser() parameters as an optional string, allowing types of either string or undefined to be supplied to this method when using Typescript, but not null.

We have opened a PR to update this here. While I do not have a firm ETA on when this change will be released, we will look to put this through our full review process when priorities allow.

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

No branches or pull requests

5 participants