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

refactor(vanilla): simplify store impl #2029

Merged
merged 6 commits into from
Aug 6, 2023
Merged

Conversation

dai-shi
Copy link
Member

@dai-shi dai-shi commented Jul 7, 2023

This is to fix the hack in #2016.
As we update state wisely in #1956, we should be able to skip things.
Hopefully, this will improve the issue in #1901.

@vercel
Copy link

vercel bot commented Jul 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
jotai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2023 6:37am

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 7, 2023

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 89a9527:

Sandbox Source
React Configuration
React Typescript Configuration
React Browserify Configuration
React Snowpack Configuration
Next.js Configuration
Next.js with custom Babel config Configuration
React with custom Babel config Configuration

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Size Change: -64 B (0%)

Total Size: 67.9 kB

Filename Size Change
dist/system/vanilla.development.js 3.9 kB -51 B (-1%)
dist/system/vanilla.production.js 1.91 kB -9 B (0%)
dist/umd/vanilla.development.js 4.7 kB -4 B (0%)
dist/umd/vanilla.production.js 2.13 kB +7 B (0%)
dist/vanilla.js 4.61 kB -7 B (0%)
ℹ️ View Unchanged
Filename Size
dist/babel/plugin-debug-label.js 916 B
dist/babel/plugin-react-refresh.js 1.15 kB
dist/babel/preset.js 1.39 kB
dist/index.js 242 B
dist/react.js 1.05 kB
dist/react/utils.js 1.26 kB
dist/system/babel/plugin-debug-label.development.js 1.09 kB
dist/system/babel/plugin-debug-label.production.js 764 B
dist/system/babel/plugin-react-refresh.development.js 1.29 kB
dist/system/babel/plugin-react-refresh.production.js 935 B
dist/system/babel/preset.development.js 1.57 kB
dist/system/babel/preset.production.js 1.14 kB
dist/system/index.development.js 236 B
dist/system/index.production.js 167 B
dist/system/react.development.js 1.17 kB
dist/system/react.production.js 701 B
dist/system/react/utils.development.js 713 B
dist/system/react/utils.production.js 451 B
dist/system/utils.development.js 241 B
dist/system/utils.production.js 175 B
dist/system/vanilla/utils.development.js 4.51 kB
dist/system/vanilla/utils.production.js 2.76 kB
dist/umd/babel/plugin-debug-label.development.js 1.07 kB
dist/umd/babel/plugin-debug-label.production.js 850 B
dist/umd/babel/plugin-react-refresh.development.js 1.29 kB
dist/umd/babel/plugin-react-refresh.production.js 1.02 kB
dist/umd/babel/preset.development.js 1.53 kB
dist/umd/babel/preset.production.js 1.25 kB
dist/umd/index.development.js 381 B
dist/umd/index.production.js 329 B
dist/umd/react.development.js 1.18 kB
dist/umd/react.production.js 785 B
dist/umd/react/utils.development.js 1.42 kB
dist/umd/react/utils.production.js 1.03 kB
dist/umd/utils.development.js 398 B
dist/umd/utils.production.js 343 B
dist/umd/vanilla/utils.development.js 5.24 kB
dist/umd/vanilla/utils.production.js 3.23 kB
dist/utils.js 246 B
dist/vanilla/utils.js 5.1 kB

compressed-size-action

Copy link
Member Author

@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.

I think this PR is okay to merge as is.

Comment on lines +373 to 377
Array.from(atomState.d).every(
([a, s]) => a === atom || readAtomState(a) === s
)
) {
return atomState
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 hope to remove this for #1901, but this breaks various behavior including async atoms on mount. Hope to revisit it in the far future.

mountedMap.set(atom, mounted)
if (import.meta.env?.MODE !== 'production') {
mountedAtoms.add(atom)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

It feels like our mountAtom has room for improvement (like propagating changed from dependencies).
It might be related with the previous comment, but not sure.

@dai-shi dai-shi marked this pull request as ready for review July 31, 2023 06:37
@dai-shi dai-shi added this to the v2.4.0 milestone Jul 31, 2023
@dai-shi dai-shi modified the milestone: v2.3.0 Jul 31, 2023
@dai-shi dai-shi merged commit 59989ec into main Aug 6, 2023
27 checks passed
@dai-shi dai-shi deleted the refactor/vanilla/store branch August 6, 2023 23:53
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.

1 participant