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

Transactions cause fcl to switch currentUser to ServiceAccount (0.0.78) #225

Open
cbcomdev opened this issue Feb 15, 2022 · 1 comment
Open
Labels
bug Something isn't working feedback

Comments

@cbcomdev
Copy link

Note: I'm cross-posting this from onflow/fcl-js#1017 at the request of @chasefleming

Problem

While working on a project which implements functionality from KittyItems, I noticed that transactions appeared to be forcing currentUser to automatically swap to the ServiceAccount. This is with @onflow/fcl 0.0.78, fcl-dev-wallet:0.3.1, and emulator:latest. This did not happen with fcl-js 0.0.77.

Steps to Reproduce

  • Clone https://github.com/onflow/kitty-items
  • (If you already have it) Clear any cached "web"-related images in Docker.
  • Update web package.json to "@onflow/fcl": "0.0.78"
  • Add BASE_URL=http://localhost:8701 to dev-wallet env (in docker-compose.yml)
  • Deploy the project locally
  • Login as ServiceAccount, Initialize, and Mint an item
  • Log out, Fund Account A, login as Account A
  • Attempt to purchase an item

You will see the following warning in dev console:

You are manually enabling a very experimental feature that is not yet standard, use at your own risk.
         You can disable this warning by setting fcl.warning.suppress.redir to true in your config

You'll also see that fcl.currentUser().subscribe has updated the current user back to ServiceAccount. Additionally, you can see that even the Initialize and Mint transactions called when logged in as ServiceAccount caused the warning to fire and currentUser to swap (though, since you're logged in as ServiceAccount at the time, it doesn't impact anything).

This warning is coming from: https://github.com/onflow/fcl-js/blob/master/packages/fcl/src/current-user/index.js#L116

@cbcomdev cbcomdev added bug Something isn't working feedback labels Feb 15, 2022
@alse
Copy link
Contributor

alse commented Feb 15, 2022

Hey @cbcomdev, KittyItems was just updated to use @onflow/fcl:0.0.79-alpha.3 and fcl-dev-wallet:0.3.2. I couldn't reproduce the problem in the latest version, could you give it a try?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feedback
Projects
None yet
Development

No branches or pull requests

2 participants