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

chore: fix the NODE_ENV workaround in Provider #446

Merged
merged 3 commits into from
Apr 24, 2021

Conversation

dai-shi
Copy link
Member

@dai-shi dai-shi commented Apr 23, 2021

@Thisen does a trick in #425, which seems better than my workaround.
So, this PR fixes it.

However, this PR reveals some other issues. It now shows some warnings on tests. This should actually be addressed in the second iteration of snapshot-based devtools.

Also, fixed warnings in provider-less mode tests. some of tests are missing for provider-less mode. And found an issue with atomWithQuery, which should be addressed separtely (FIXME).

@dai-shi dai-shi requested a review from Thisen April 23, 2021 23:39
@vercel
Copy link

vercel bot commented Apr 23, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pmndrs/jotai/DBQR7nFY8SJLaVW983Xt8Cn48ThL
✅ Preview: https://jotai-git-chore-fix-node-env-test-in-provider-pmndrs.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 23, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b06c22c:

Sandbox Source
React Configuration
React Typescript Configuration

})
afterEach(() => {
process.env.NODE_ENV = savedNodeEnv
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, does this mean onMount has some issues with DEV mode? Or, is it just a testing thing?
Needs investigation. Help wanted.

import { fireEvent, render, waitFor } from '@testing-library/react'
import { Provider as ProviderOrig, atom, useAtom, Atom } from '../src/index'

const Provider = process.env.PROVIDER_LESS_MODE ? Fragment : ProviderOrig
const Provider = process.env.PROVIDER_LESS_MODE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe extract this to a util function and use it everywhere?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dai-shi I'll do that and commit - Then you can revert if you disagree :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Thanks for the suggestion.

@dai-shi dai-shi merged commit 37f030b into master Apr 24, 2021
@dai-shi dai-shi deleted the chore/fix-node-env-test-in-provider branch April 24, 2021 11:34
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

Successfully merging this pull request may close these issues.

None yet

2 participants