@Xstate/react 1.0.0 bug
This repo reproduces a bug introduced with @xstate/react
1.0.0
Quick start
- Clone this repo.
- Make a copy of the file
.env.example
and rename it to.env
- Head over to Firebase console and create a new project.
- From the Project Overview general settings, add a new Firebase app.
- Head over
Authentication
sign-in methods and enable email/password method. - Create a new user and write down email and password for later use.
- Uncomment all lines in your
.env
file and fill in the keys with your Firebase app config values forapiKey
,authDomain
andprojectId
. - On a terminal window, from the project root directory, install dependencies by running
yarn install
. You can usenpm install
too if you like. Then runyarn dev
ornpm run dev
. - Open your browser and visit
http://localhost:3000
Usage
You'll see a bare-bones although functional login form. Use the credential for the user created previously. You'll be able to sign in and sign out. Firebase user object is saved in the auth
machine's context.user
property.
Reproducing the bug
- In the terminal run
yarn add -E @xstate/react@1.0.0
. - Open the file
./contexts/auth-context.tsx
. - Replace line 19,
const [state, send] = useService(actor)
, withconst [state, send] = useActor(actor)
. - Fix the import statement on line 1, to reflect the change.
- Try to log in again in your browser and see it fail.
- No error message will be logged.