💊 Valtio makes proxy-state simple for React and Vanilla
MIT License
Bot releases are hidden (Show)
Published by dai-shi over 2 years ago
⚠️ ⚠️ ⚠️ v1.2.10 turns out to have some bugs. Please use v1.2.11 instead. The Migration Guide below is still valid.
This adds new proxyMap
and fixes derive
, both in valtio/utils
. The internal DeepResolveType
type is deprecated, which might require migration.
In case you need to specify snapshot types, there are two options.
type State = { foo?: string }
const state = proxy<State>({})
const snap = useSnapshot(state) as State
const handleSnap = (s: State) => {
// ...
}
as State
can be as typeof state
.
Readonly<>
type State = { foo?: string }
const state = proxy<State>({})
const snap = useSnapshot(state)
const handleSnap = (s: Readonly<State>) => {
// ...
}
Readonly<State>
can be Readonly<typeof state>
If the state is deeply nested, please define DeepReadonly
type util.
type DeepReadonly<T> = {
readonly [P in keyof T]: DeepReadonly<T[P]>;
}
const handleSnap = (s: DeepReadonly<State>) => {
// ...
}
Full Changelog: https://github.com/pmndrs/valtio/compare/v1.2.9...v1.2.10
Published by dai-shi almost 3 years ago
This has small fixes in core, but most notably, it adds a new proxySet
util in valtio/utils
.
[Important Note] #324 change can be breaking in types if some types are explicitly typed without readonly
. See #327 for discussions.
Full Changelog: https://github.com/pmndrs/valtio/compare/v1.2.8...v1.2.9
Published by dai-shi almost 3 years ago
This adds unstable_getHandler
api which is not documented. It includes some refactorings internally. Please report issues if something goes wrong. Also, this adds UMD and SystemJS builds for CDN.
Full Changelog: https://github.com/pmndrs/valtio/compare/v1.2.7...v1.2.8
Published by dai-shi almost 3 years ago
This should improve performance. 🚀
Full Changelog: https://github.com/pmndrs/valtio/compare/v1.2.6...v1.2.7
Published by dai-shi almost 3 years ago
Improved devtools
util.
Full Changelog: https://github.com/pmndrs/valtio/compare/v1.2.5...v1.2.6
Published by dai-shi about 3 years ago
Based on some feedbacks, this version includes some minor fixes.
Full Changelog: https://github.com/pmndrs/valtio/compare/v1.2.4...v1.2.5
Published by dai-shi about 3 years ago
v1.2.3 accidentally requires newer node.js versions. v1.2.4 fixes it by reverting exports format.
Published by dai-shi about 3 years ago
⚠️ Minimum Node.js requirements (for server-side usage like Next.js): v14.13.0, v12.20.0
This improves devtools
in valtio/utils
.
Published by dai-shi about 3 years ago
This fixes ESM exports for some environments. Some utils are also improved.
Published by dai-shi about 3 years ago
As reported in #210, there was an issue with ESM build. This version fixes it by updating the dependency.
Published by dai-shi about 3 years ago
We add a new util derive
, and deprecate addComputed
in favor of it.
In valtio, proxy objects are primitive subscription targets, and derive
is a better-fitting abstraction for creating derived / computed values. derive
is recommended for both React and Vanilla.
Published by dai-shi about 3 years ago
This fixes an issue to handle promises (a.k.a. Suspense) in snapshots.
Published by dai-shi about 3 years ago
v1.1.1 has a regression with some bundlers, which is fixed in this version.
Published by dai-shi about 3 years ago
There were some issues in valtio/utils
in v1.1.0, which is fixed in this version. It also improves ESM build to better work with various bundlers.
Published by dai-shi about 3 years ago
This version adds a new feature in subscribe
. The subscribe callback receives the changes made. This is for expert users who know how valtio behaves internally. There's no docs for the feature (TS types might help).
It has a new util proxyWithHistory
based on the new feature. This is for ordinary users.
We encourage 3rd-party library authors to develop some utils based on this new feature.
Published by dai-shi over 3 years ago
This added "import" export entries for modern bundlers. It might also fix potential bugs in useProxy
macro.
Published by dai-shi over 3 years ago
This is a maintenance release. It doesn't add any new features or fixes.
Published by dai-shi over 3 years ago
Add a new util watch
and update upstream library.
Published by dai-shi over 3 years ago
This adds two improvements.
[BREAKING CHANGE in types] Exported type NonPromise
is renamed to DeepResolveType
.
Published by dai-shi over 3 years ago
This fixes the "exports"
inconsistency issue in build (#140).