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

v2 #810

Merged
merged 46 commits into from
May 15, 2024
Merged

v2 #810

merged 46 commits into from
May 15, 2024

Conversation

dai-shi
Copy link
Member

@dai-shi dai-shi commented Nov 6, 2023

Related Issues or Discussions

#703

Tasks

Copy link

vercel bot commented Nov 6, 2023

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

Name Status Preview Comments Updated (UTC)
valtio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 12, 2024 6:10am

Copy link

codesandbox-ci bot commented Nov 6, 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.

Copy link

github-actions bot commented Nov 6, 2023

Size Change: -54.5 kB (-89.81%) 🏆

Total Size: 6.18 kB

Filename Size Change
dist/esm/index.js 0 B -62 B (removed) 🏆
dist/esm/macro.js 0 B -698 B (removed) 🏆
dist/esm/macro/vite.js 0 B -864 B (removed) 🏆
dist/esm/react.js 0 B -732 B (removed) 🏆
dist/esm/react/utils.js 0 B -258 B (removed) 🏆
dist/esm/utils.js 0 B -68 B (removed) 🏆
dist/esm/vanilla.js 0 B -2.44 kB (removed) 🏆
dist/esm/vanilla/utils.js 0 B -3.17 kB (removed) 🏆
dist/macro.js 0 B -919 B (removed) 🏆
dist/macro/vite.js 0 B -1.08 kB (removed) 🏆
dist/react.js 663 B -5 B (-0.75%)
dist/system/index.development.js 0 B -253 B (removed) 🏆
dist/system/index.production.js 0 B -183 B (removed) 🏆
dist/system/macro.development.js 0 B -780 B (removed) 🏆
dist/system/macro.production.js 0 B -556 B (removed) 🏆
dist/system/macro/vite.development.js 0 B -951 B (removed) 🏆
dist/system/macro/vite.production.js 0 B -660 B (removed) 🏆
dist/system/react.development.js 0 B -872 B (removed) 🏆
dist/system/react.production.js 0 B -473 B (removed) 🏆
dist/system/react/utils.development.js 0 B -357 B (removed) 🏆
dist/system/react/utils.production.js 0 B -237 B (removed) 🏆
dist/system/utils.development.js 0 B -259 B (removed) 🏆
dist/system/utils.production.js 0 B -187 B (removed) 🏆
dist/system/vanilla.development.js 0 B -2.58 kB (removed) 🏆
dist/system/vanilla.production.js 0 B -1.52 kB (removed) 🏆
dist/system/vanilla/utils.development.js 0 B -3.38 kB (removed) 🏆
dist/system/vanilla/utils.production.js 0 B -2.22 kB (removed) 🏆
dist/umd/index.development.js 0 B -382 B (removed) 🏆
dist/umd/index.production.js 0 B -330 B (removed) 🏆
dist/umd/macro.development.js 0 B -1.03 kB (removed) 🏆
dist/umd/macro.production.js 0 B -721 B (removed) 🏆
dist/umd/macro/vite.development.js 0 B -1.23 kB (removed) 🏆
dist/umd/macro/vite.production.js 0 B -879 B (removed) 🏆
dist/umd/react.development.js 0 B -814 B (removed) 🏆
dist/umd/react.production.js 0 B -526 B (removed) 🏆
dist/umd/react/utils.development.js 0 B -433 B (removed) 🏆
dist/umd/react/utils.production.js 0 B -314 B (removed) 🏆
dist/umd/utils.development.js 0 B -398 B (removed) 🏆
dist/umd/utils.production.js 0 B -344 B (removed) 🏆
dist/umd/vanilla.development.js 0 B -2.76 kB (removed) 🏆
dist/umd/vanilla.production.js 0 B -1.64 kB (removed) 🏆
dist/umd/vanilla/utils.development.js 0 B -7.14 kB (removed) 🏆
dist/umd/vanilla/utils.production.js 0 B -4.92 kB (removed) 🏆
dist/vanilla.js 2.35 kB -280 B (-10.63%) 👏
dist/vanilla/utils.js 2.4 kB -4.56 kB (-65.51%) 🏆
ℹ️ View Unchanged
Filename Size
dist/index.js 243 B
dist/react/utils.js 277 B
dist/utils.js 247 B

compressed-size-action

* [v2] breaking: do not throw promises

* use use

* fix CI hopefully

* fix CI hopefully 2

* fix CI hopefully 3

* fix CI hopefully 4

* fix CI hopefully 5

* any type for simplicity
* [v2] breaking: do not copy initial objects

* fix deepClone

* refactor

* ah we need it

* deep clone

* minor fix
* TS minimal requirement v4.5

* wip: test old ts

* remove downlevel-dts

* simplify test

* simplify test 2

* simplify test 3

* wip: useMaybePromise

* wip: useMaybePromise 2

* wip: useMaybePromise 3

* rename back
* [v2] breaking: require react 18 and drop use-sync-external-store

* drop tests pre react 18

* wip: cannot use react 17 for prd test

* drop production test which is impossible

* esm?

* fix regex

* fix sed
* remove depreacated useProxy macro

* revert plugin-transform

* remove two more babel packages

* revert babel core

* remove proxyWithComputed

* remove addComputed

* remove devtools deprecated option
* [v2] breaking: drop UMD/SystemJS builds and simplify babel config

* format
@dai-shi
Copy link
Member Author

dai-shi commented Apr 29, 2024

* Address spurious consistency check re-renders by using useLayoutEffect inside useSnapshot instead of useEffect

* Move regression tests for useSnapshot perf improvement to optimization test file

* Update tests/optimization.test.tsx

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
@dai-shi dai-shi marked this pull request as ready for review May 4, 2024 00:22
@dai-shi
Copy link
Member Author

dai-shi commented May 4, 2024

@dai-shi dai-shi merged commit 71111b7 into main May 15, 2024
24 checks passed
@dai-shi dai-shi deleted the v2 branch May 15, 2024 15:28
@L-Qun
Copy link
Contributor

L-Qun commented Jun 4, 2024

I am curious why valtio is the best state management library supported for react19? It seems that there is no PR related to react19.

@Songkeys
Copy link

Songkeys commented Jun 4, 2024

valtio is the best state management library supported for react19

@L-Qun do you have source for this statement? would love to know more. thanks.

@L-Qun
Copy link
Contributor

L-Qun commented Jun 4, 2024

valtio is the best state management library supported for react19

@L-Qun do you have source for this statement? would love to know more. thanks.

image

@dai-shi
Copy link
Member Author

dai-shi commented Jun 4, 2024

#866 is the one related. Valtio v1 doesn't work well with React 19 with upcoming React Compiler.

It's not best state management among other libs, but I think it's unique.

@L-Qun
Copy link
Contributor

L-Qun commented Jun 5, 2024

#866 is the one related. Valtio v1 doesn't work well with React 19 with upcoming React Compiler.

It's not best state management among other libs, but I think it's unique.

@dai-shi Thank you for your reply. Could you explain the issues between Valtio v1 and the compiler, and the reasons for the changes? There aren't many details in the PR. Looking forward to your response.

@dai-shi
Copy link
Member Author

dai-shi commented Jun 6, 2024

Some links that may help:

Hmm, there must be some descriptions more with examples, but I can't find it now.

Basically, if you have, useMemo(() => snap.a, [snap]),

first render: .a is touched and recorded as tracked, but
second render: .a isn't touchd and nothing is tracked, so

when .a changes, it doesn't trigger rerender (This is v1 behavior. v2 does trigger.)

Brooooooklyn pushed a commit to toeverything/AFFiNE that referenced this pull request Aug 30, 2024
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [valtio](https://github.com/pmndrs/valtio) | [`^1.13.2` -> `^2.0.0`](https://renovatebot.com/diffs/npm/valtio/1.13.2/2.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/valtio/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/valtio/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/valtio/1.13.2/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/valtio/1.13.2/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>pmndrs/valtio (valtio)</summary>

### [`v2.0.0`](https://github.com/pmndrs/valtio/releases/tag/v2.0.0)

[Compare Source](https://github.com/pmndrs/valtio/compare/v1.13.2...v2.0.0)

### 🎉🎉🎉 Valtio v2 is Here! 🍾🍾🍾

#### Small Breaking Changes

Most users won't even notice the differences, but we recommend checking out the [migration guide](https://github.com/pmndrs/valtio/blob/main/docs/guides/migrating-to-v2.mdx) to ensure a smooth transition.

#### New Emoji

💊 -> 🧙

Say hello to our new emoji! This change symbolizes the magic of Valtio.

#### Let’s Grow the Ecosystem Together!

We are entering a new era of Valtio development, and we need your help to grow the ecosystem. Whether you are an experienced contributor or just getting started, now is the perfect time to join us!

#### What's Changed

-   v2 by [@&#8203;dai-shi](https://github.com/dai-shi) in [pmndrs/valtio#810
-   feat(core): expose internal states and functions by [@&#8203;dai-shi](https://github.com/dai-shi) in [pmndrs/valtio#931
-   breaking(vanilla): do not handle promises by [@&#8203;dai-shi](https://github.com/dai-shi) in [pmndrs/valtio#934

#### New Contributors

-   [@&#8203;AmirSa12](https://github.com/AmirSa12) made their first contribution in [pmndrs/valtio#898
-   [@&#8203;TotallyBiased](https://github.com/TotallyBiased) made their first contribution in [pmndrs/valtio#901
-   [@&#8203;L-Qun](https://github.com/L-Qun) made their first contribution in [pmndrs/valtio#908
-   [@&#8203;himself65](https://github.com/himself65) made their first contribution in [pmndrs/valtio#920
-   [@&#8203;kciter](https://github.com/kciter) made their first contribution in [pmndrs/valtio#922

**Full Changelog**: pmndrs/valtio@v1.13.2...v2.0.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41Ni4wIiwidXBkYXRlZEluVmVyIjoiMzguNTYuMCIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->
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.

4 participants