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

Snapshot-based devtools (1st iteration) #425

Merged
merged 16 commits into from
Apr 24, 2021
Merged

Conversation

Thisen
Copy link
Collaborator

@Thisen Thisen commented Apr 15, 2021

See #388.

  • Impl
  • Tests

This is the first iteration of snapshot-based devtools. It's not ready yet for public use.

@Thisen
Copy link
Collaborator Author

Thisen commented Apr 15, 2021

Everyone feel free to take a look.

@dai-shi with this current logic in Provider.ts:

if (
    typeof process === 'object' &&
    process.env.NODE_ENV !== 'production' &&
    process.env.NODE_ENV !== 'test'
)

How do I create tests for the devtools stuff? I could find a simple solution with NODE_ENV, but lets aim for a good way to run these tests.

CC: @Thiesl137

@dai-shi
Copy link
Member

dai-shi commented Apr 16, 2021

Great work. So far, so good. I'd like to spend time to think about better internal apis for second iteration.
For this iteration, remainings are 1) TODO to create final snapshot map, 2) tests?

process.env.NODE_ENV !== 'test'

This is something we are not happy with. I just added to pass some of tests (optimizations?), but happy to remove it and handle it in tests, if there's a solution (there must be).

src/core/Provider.ts Outdated Show resolved Hide resolved
@vercel
Copy link

vercel bot commented Apr 21, 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/8o7y3NHyh7cEU2HbHAKQ4dQHbCwx
✅ Preview: https://jotai-git-feat-devtool-snapshots-pmndrs.vercel.app

[Deployment for 6cc8f88 failed]

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 21, 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 b0e9b07:

Sandbox Source
React Configuration
React Typescript Configuration

@Thisen
Copy link
Collaborator Author

Thisen commented Apr 23, 2021

@dai-shi Feel free to review now. Make sure to look at imports aswell, not sure how to deal with those without exposing a bunch of internal APIs.

I think we should let me be undocumented, while we iterate on this API.

Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

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

Overall, it looks good to me for the 1st iteration.

src/devtools/useAtomsSnapshot.ts Outdated Show resolved Hide resolved
tests/devtools/useAtomsSnapshot.test.tsx Show resolved Hide resolved
tests/devtools/useAtomsSnapshot.test.tsx Outdated Show resolved Hide resolved
src/devtools/useAtomsSnapshot.ts Outdated Show resolved Hide resolved
@dai-shi dai-shi changed the title Snapshot-based devtools Snapshot-based devtools (1st iteration) Apr 23, 2021
@dai-shi
Copy link
Member

dai-shi commented Apr 24, 2021

#446 is merged. Please adjust this PR a bit.

@dai-shi dai-shi merged commit 59359b2 into master Apr 24, 2021
@dai-shi dai-shi deleted the feat/devtool-snapshots branch April 24, 2021 23:27
dai-shi added a commit that referenced this pull request Apr 24, 2021
dai-shi added a commit that referenced this pull request Apr 24, 2021
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