@legendapp/state 3.0.0-alpha.4 → 3.0.0-alpha.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.DS_Store +0 -0
- package/CHANGELOG.md +831 -1
- package/LICENSE +21 -1
- package/README.md +141 -1
- package/babel.js +0 -2
- package/babel.mjs +0 -2
- package/config/configureLegendState.d.mts +13 -0
- package/config/configureLegendState.d.ts +13 -0
- package/config/configureLegendState.js +45 -0
- package/config/configureLegendState.mjs +43 -0
- package/config/enable$GetSet.js +2 -1
- package/config/enable$GetSet.mjs +2 -1
- package/config/enableReactTracking.js +2 -1
- package/config/enableReactTracking.mjs +2 -1
- package/config/enableReactUse.js +2 -1
- package/config/enableReactUse.mjs +2 -1
- package/config/enable_PeekAssign.js +2 -1
- package/config/enable_PeekAssign.mjs +2 -1
- package/helpers/trackHistory.js +2 -2
- package/helpers/trackHistory.mjs +2 -2
- package/index.d.mts +106 -81
- package/index.d.ts +106 -81
- package/index.js +347 -335
- package/index.mjs +344 -333
- package/package.json +36 -1
- package/persist-plugins/async-storage.d.mts +6 -3
- package/persist-plugins/async-storage.d.ts +6 -3
- package/persist-plugins/async-storage.js +8 -4
- package/persist-plugins/async-storage.mjs +8 -5
- package/persist-plugins/indexeddb.d.mts +6 -4
- package/persist-plugins/indexeddb.d.ts +6 -4
- package/persist-plugins/indexeddb.js +35 -15
- package/persist-plugins/indexeddb.mjs +35 -16
- package/persist-plugins/mmkv.d.mts +5 -1
- package/persist-plugins/mmkv.d.ts +5 -1
- package/persist-plugins/mmkv.js +10 -5
- package/persist-plugins/mmkv.mjs +10 -6
- package/react-reactive/enableReactComponents.d.mts +9 -0
- package/react-reactive/enableReactComponents.d.ts +9 -0
- package/react-reactive/enableReactComponents.js +19 -0
- package/react-reactive/enableReactComponents.mjs +17 -0
- package/react-reactive/enableReactNativeComponents.d.mts +22 -0
- package/react-reactive/enableReactNativeComponents.d.ts +22 -0
- package/react-reactive/enableReactNativeComponents.js +53 -0
- package/react-reactive/enableReactNativeComponents.mjs +51 -0
- package/react-reactive/enableReactive.d.mts +5 -0
- package/react-reactive/enableReactive.d.ts +5 -0
- package/react-reactive/enableReactive.js +24 -0
- package/react-reactive/enableReactive.mjs +22 -0
- package/react-reactive/enableReactive.native.d.mts +5 -0
- package/react-reactive/enableReactive.native.d.ts +5 -0
- package/react-reactive/enableReactive.native.js +58 -0
- package/react-reactive/enableReactive.native.mjs +56 -0
- package/react-reactive/enableReactive.web.d.mts +5 -0
- package/react-reactive/enableReactive.web.d.ts +5 -0
- package/react-reactive/enableReactive.web.js +58 -0
- package/react-reactive/enableReactive.web.mjs +56 -0
- package/react.d.mts +39 -34
- package/react.d.ts +39 -34
- package/react.js +54 -27
- package/react.mjs +55 -28
- package/sync-plugins/crud.d.mts +21 -24
- package/sync-plugins/crud.d.ts +21 -24
- package/sync-plugins/crud.js +241 -140
- package/sync-plugins/crud.mjs +243 -142
- package/sync-plugins/fetch.js +12 -8
- package/sync-plugins/fetch.mjs +13 -9
- package/sync-plugins/firebase.d.mts +27 -0
- package/sync-plugins/firebase.d.ts +27 -0
- package/sync-plugins/firebase.js +373 -0
- package/sync-plugins/firebase.mjs +368 -0
- package/sync-plugins/keel.d.mts +43 -26
- package/sync-plugins/keel.d.ts +43 -26
- package/sync-plugins/keel.js +145 -100
- package/sync-plugins/keel.mjs +147 -100
- package/sync-plugins/supabase.d.mts +19 -9
- package/sync-plugins/supabase.d.ts +19 -9
- package/sync-plugins/supabase.js +52 -22
- package/sync-plugins/supabase.mjs +53 -23
- package/sync-plugins/tanstack-query.d.mts +2 -2
- package/sync-plugins/tanstack-query.d.ts +2 -2
- package/sync-plugins/tanstack-query.js +22 -5
- package/sync-plugins/tanstack-query.mjs +22 -5
- package/sync-plugins/tanstack-react-query.d.mts +1 -1
- package/sync-plugins/tanstack-react-query.d.ts +1 -1
- package/sync-plugins/tanstack-react-query.js +8 -1
- package/sync-plugins/tanstack-react-query.mjs +8 -1
- package/sync.d.mts +74 -200
- package/sync.d.ts +74 -200
- package/sync.js +510 -307
- package/sync.mjs +516 -313
- package/types/babel.d.ts +12 -1
- /package/config/{enable_GetSet.d.mts → enable$GetSet.d.mts} +0 -0
- /package/config/{enable_GetSet.d.ts → enable$GetSet.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1 +1,831 @@
|
|
|
1
|
-
|
|
1
|
+
## 3.0.0-alpha.1
|
|
2
|
+
- Fix: The new undoRedo helper was not exported correctly, moved it to `/helpers`
|
|
3
|
+
- Fix: IndexedDB plugin was not saving primitives properly when combined with `itemID` option
|
|
4
|
+
|
|
5
|
+
## 3.0.0-alpha.0
|
|
6
|
+
See https://www.legendapp.com/open-source/state/v3/other/migrating/ for details
|
|
7
|
+
- Types: Rewritten from scratch to be much better
|
|
8
|
+
- Feat: computed/proxy are now just functions
|
|
9
|
+
- Feat: New synced with much improved sync/persist functionality
|
|
10
|
+
- Feat: New sync plugins for Keel, Supabase, TanStack Query, fetch
|
|
11
|
+
- Removed: Old persist system, persistObservable, usePersistedObservable, etc...
|
|
12
|
+
- Change: useObservable with a function parameter is now reactive like useComputed was. So use peek() when accessing observables inside it if you want it to be just an initial value and not be reactive.
|
|
13
|
+
- Change: Computeds now only re-compute themselves when observed. This may cause some migration issues if your computeds had side effects, as they will not re-run when dependencies change unless being observed.
|
|
14
|
+
- Removed: lockObservable - With the new method of computeds it's not possible to modify the types to be readonly, so we removed this feature.
|
|
15
|
+
- Change: set and toggle return void: They had previously returned the observable in order to allow chaining, but it caused unintended side effects, so they now return void.
|
|
16
|
+
- Change: `onSet` was renamed to `onAfterSet` for clarity
|
|
17
|
+
- Removed: The concept of "after batch" - it was generally unreliable because batches can run recursively
|
|
18
|
+
- Renamed: `enableDirectAccess()` to `enable$GetSet()` and `enableDirectPeek()` to `enable_PeekAssign()` for clarity
|
|
19
|
+
|
|
20
|
+
## 2.1.14
|
|
21
|
+
- Fix: Improved and better tested babel plugin - By @hzoo https://github.com/LegendApp/legend-state/pull/270
|
|
22
|
+
- Fix: useSelector with an observable was ignoring suspense option - By @lishine https://github.com/LegendApp/legend-state/pull/291
|
|
23
|
+
- Feat: An undoRedo helper to add undo/redo functionality to an observable
|
|
24
|
+
|
|
25
|
+
## 2.1.13
|
|
26
|
+
- Fix: Not persisting Map/Set correctly if at root of observable
|
|
27
|
+
|
|
28
|
+
## 2.1.12
|
|
29
|
+
- Fix: useSelector only short-circuits creating a hook if parameter is an observable, fixing useSelector re-rendering when its return value hadn't changed
|
|
30
|
+
|
|
31
|
+
## 2.1.11
|
|
32
|
+
- Fix: Recent useSelector optimizations causing some issuesin dev strict mode
|
|
33
|
+
|
|
34
|
+
## 2.1.10
|
|
35
|
+
- Fix: Types of observer
|
|
36
|
+
|
|
37
|
+
## 2.1.9
|
|
38
|
+
- Fix: useSelector was creating too many listeners
|
|
39
|
+
|
|
40
|
+
## 2.1.8
|
|
41
|
+
- Fix: array includes was not working correctly
|
|
42
|
+
|
|
43
|
+
## 2.1.7
|
|
44
|
+
- Fix: typescript errors when external imports are not available
|
|
45
|
+
|
|
46
|
+
## 2.1.6
|
|
47
|
+
- Fix: changed type imports from external packages to fail gracefully if they don't exist in node
|
|
48
|
+
|
|
49
|
+
## 2.1.5
|
|
50
|
+
- Fix: Dates were being considered as objects and were sometimes not being considered changed
|
|
51
|
+
|
|
52
|
+
## 2.1.4
|
|
53
|
+
- Fix: observe not running reaction if selector is an object or array
|
|
54
|
+
|
|
55
|
+
## 2.1.3
|
|
56
|
+
- Fix: An occasional error in sync get function
|
|
57
|
+
|
|
58
|
+
## 2.1.2
|
|
59
|
+
- Fix: Local cache was not saving Map/Set correctly
|
|
60
|
+
|
|
61
|
+
## 2.1.1
|
|
62
|
+
- Feat: usePauseProvider to pause/resume all updates under a context
|
|
63
|
+
|
|
64
|
+
## 2.0.3
|
|
65
|
+
- Feat: support persistence with no get
|
|
66
|
+
- Fix: errors in observer components getting swallowed
|
|
67
|
+
|
|
68
|
+
# 2.0.2
|
|
69
|
+
- Fix: persistence was not adding clearLocal to the new state node
|
|
70
|
+
- Fix: removed clearing ref from useObserve - it was causing fast refresh bugs and wasn't really necessary
|
|
71
|
+
- Package: Added react as an optional peerDependency
|
|
72
|
+
- Change: promise/persisted state key to support _state so it doesn't break user data with state keys, will slowly migrate to that
|
|
73
|
+
|
|
74
|
+
## 2.0.0
|
|
75
|
+
|
|
76
|
+
### Breaking
|
|
77
|
+
- Change: Setting a promise into an observable now creates a child prop `state` which is not in the raw data and is only accessible through the observable containing `{ isLoaded, error }`
|
|
78
|
+
- Change: Renamed some parameters in `persistObservable` and `configureObservablePersistence`
|
|
79
|
+
- Change: `afterBatch` removed and functionality merged into `batch`
|
|
80
|
+
- Removed: `/react-components` exports
|
|
81
|
+
- Removed: `enableLegendStateReact`
|
|
82
|
+
- Removed: `eachValues` prop from `For`
|
|
83
|
+
- Deprecated: `enableReactDirectRender`
|
|
84
|
+
- Deprecated: Reactive props ending in $ in favor of starting with $
|
|
85
|
+
|
|
86
|
+
### Improvements
|
|
87
|
+
- Docs: Brand new docs site at https://legendapp.com/open-source/state with better design, navigation sidebar, search
|
|
88
|
+
- Feat: Remote persistence with plugins for `fetch`, TanStack-Query, and Firebase Realtime Database
|
|
89
|
+
- Feat: `enableReactTracking({ auto: true })` to make components automatically track `get()` calls on observables
|
|
90
|
+
- Feat: `useWhen` and `useWhenReady` hooks
|
|
91
|
+
- Feat: `computed` can be set or assigned into an observable after creation
|
|
92
|
+
- Perf: Observable nodes activate lazily so creating or setting large objects is much faster
|
|
93
|
+
- Fix: Misc bugs with mergeIntoObservable
|
|
94
|
+
- Fix: Reactive.FlatList $data prop was not working
|
|
95
|
+
|
|
96
|
+
See https://legendapp.com/open-source/legend-state-v2/ for more details.
|
|
97
|
+
|
|
98
|
+
## 1.11.3
|
|
99
|
+
|
|
100
|
+
- Fix: computed was not activating if its value started as undefined
|
|
101
|
+
|
|
102
|
+
## 1.11.2
|
|
103
|
+
|
|
104
|
+
- Fix: useSelector was always re-rendering even if the returned value didn't change
|
|
105
|
+
|
|
106
|
+
## 1.11.1
|
|
107
|
+
|
|
108
|
+
- Removed the deprecation warning about reactive props since that might affect a lot of people and we can migrate that more slowly.
|
|
109
|
+
|
|
110
|
+
## 1.11.0
|
|
111
|
+
|
|
112
|
+
- This version displays deprecation warnings to prepare for version 2.0 release which will remove the deprecated features. See https://legendapp.com/open-source/state/migrating/ for details on migration or disabling the warning.
|
|
113
|
+
|
|
114
|
+
## 1.10.3
|
|
115
|
+
|
|
116
|
+
- Fix: Reactive elements were not supporting observable children
|
|
117
|
+
|
|
118
|
+
## 1.10.2
|
|
119
|
+
|
|
120
|
+
- Types: Improve types of useObservableQuery - By @bram209 https://github.com/LegendApp/legend-state/pull/182
|
|
121
|
+
|
|
122
|
+
## 1.10.1
|
|
123
|
+
|
|
124
|
+
- Types: Types of Map and Set were not correct if at the root of an observable
|
|
125
|
+
- Fix: `size` property of Map was not an observable
|
|
126
|
+
|
|
127
|
+
## 1.10.0
|
|
128
|
+
|
|
129
|
+
- Feat: `proxy` supports three modes like computed: proxy to a computed plain object, proxy to an observable, proxy to a two-way computed
|
|
130
|
+
- Feat: `proxy` sets raw values on parents and notifies when proxied children change
|
|
131
|
+
- Fix: optimize batching so that modifying a child after modifying its parent merges into the existing change rather than creating a new change
|
|
132
|
+
- Fix: `Show` was not passing value to children when children is a function
|
|
133
|
+
|
|
134
|
+
## 1.9.0
|
|
135
|
+
|
|
136
|
+
- Feat: Nested computeds set their value on the raw object so that `get()` on the parent will include the values of child computeds
|
|
137
|
+
|
|
138
|
+
## 1.8.1
|
|
139
|
+
|
|
140
|
+
- Feat: Added findIDKey and optimized to internal
|
|
141
|
+
- Fix: Added more safety around dev-only assertions because they were throwing errors in some build systems
|
|
142
|
+
|
|
143
|
+
## 1.8.0
|
|
144
|
+
|
|
145
|
+
- Feat: Support Suspense with `useSelector(state, { suspend: true })` or `state.use({ suspend: true })`
|
|
146
|
+
|
|
147
|
+
## 1.7.3
|
|
148
|
+
|
|
149
|
+
- Types: Improved types of proxy so it can have complex mapped types
|
|
150
|
+
|
|
151
|
+
## 1.7.2
|
|
152
|
+
|
|
153
|
+
- Fix: opaqueObject was not blocking looping through objects in constructor https://github.com/LegendApp/legend-state/issues/163
|
|
154
|
+
|
|
155
|
+
## 1.7.1
|
|
156
|
+
|
|
157
|
+
Fix: the change to add SessionStorage was crashing when run server-side in Next.js
|
|
158
|
+
|
|
159
|
+
## 1.7.0
|
|
160
|
+
|
|
161
|
+
- Feat: Add `ObservablePersistSessionStorage`. -By @minorgod https://github.com/LegendApp/legend-state/pull/164
|
|
162
|
+
|
|
163
|
+
## 1.6.4
|
|
164
|
+
|
|
165
|
+
- Types: `Selector` now allows `ObservableEvent`
|
|
166
|
+
- Types: `ObservableWriteable` was not exactly correct after the change to add Promise to `set`
|
|
167
|
+
|
|
168
|
+
## 1.6.3
|
|
169
|
+
|
|
170
|
+
- Fix: `useObservableNextRouter` was throwing warnings on some route changes
|
|
171
|
+
- Fix: `enableDirectPeek` set now matches normal set behavior with promise and function extraction and all
|
|
172
|
+
- Types: Package is now built in TypeScript strict mode
|
|
173
|
+
|
|
174
|
+
## 1.6.2
|
|
175
|
+
|
|
176
|
+
- Types: Improved types of Computed, Memo, and the babel transform
|
|
177
|
+
- Types: Improved handling of null and undefined in observables
|
|
178
|
+
|
|
179
|
+
## 1.6.1
|
|
180
|
+
|
|
181
|
+
- Types: Improve handling of optional properties in observable constructor
|
|
182
|
+
- Types: Add missing Promise type in set function
|
|
183
|
+
|
|
184
|
+
## 1.6.0
|
|
185
|
+
|
|
186
|
+
- Feat: `set` automatically unwraps promises
|
|
187
|
+
|
|
188
|
+
## 1.5.1
|
|
189
|
+
|
|
190
|
+
- Fix: Optional properties in observables were causing TS warnings
|
|
191
|
+
|
|
192
|
+
## 1.5.0
|
|
193
|
+
|
|
194
|
+
- Feat: add Reactive components, with configuration for React and React Native, to replace Legend components
|
|
195
|
+
- Fix: Improved types of useObservableQuery -By @sheldon-welinga https://github.com/LegendApp/legend-state/pull/146
|
|
196
|
+
- Fix: babel transform was breaking Memo/Computed with observable child
|
|
197
|
+
|
|
198
|
+
## 1.4.0
|
|
199
|
+
|
|
200
|
+
- Feat: Returning an observable in a computed creates a two-way link to the target observable.
|
|
201
|
+
- Feat: `computed` is supported as a child of an observable
|
|
202
|
+
- Feat: `proxy` is like a `computed` but given a key, usable by indexing into an object with a string key
|
|
203
|
+
- Feat: Functions and computeds in the hierarchy of the constructing object in an observable are extracted into observable metadata so that setting the observable does not delete them.
|
|
204
|
+
- Feat: `Memo` and `Computed` support observables as children
|
|
205
|
+
- Feat: `reactiveComponents` makes multiple reactive components at once from the children of the target object
|
|
206
|
+
- Feat: Reactive components and `reactive` makes children reactive if it's a functions
|
|
207
|
+
- Fix: `useObserve` updates the compute and set functions when re-run
|
|
208
|
+
- Fix: Direct setting with `_` was not working with falsy values
|
|
209
|
+
- Change: Reactive props will now start with `$` instead of ending with `$`. Both work for now, but `prop$` will be deprecated in a later version.
|
|
210
|
+
- Perf: `useSelector` skips creating a hook if it's inside an `observer`
|
|
211
|
+
|
|
212
|
+
## 1.3.6
|
|
213
|
+
|
|
214
|
+
- Fix: Setting a primitive observable to the same value was still notifying listeners
|
|
215
|
+
|
|
216
|
+
## 1.3.5
|
|
217
|
+
|
|
218
|
+
- Fix: array.find was returning `[]` instead of `undefined` when it found no matches
|
|
219
|
+
|
|
220
|
+
## 1.3.4
|
|
221
|
+
|
|
222
|
+
- Feat: (experimental) `enableDirectPeek` enables a property on observables named _ as a shorthand for peek(), and assigning to it modifies the underlying object without notifying listeners of changes.
|
|
223
|
+
|
|
224
|
+
## 1.3.2
|
|
225
|
+
|
|
226
|
+
- Fix: `reactive` was not working with some external packages like NativeBase
|
|
227
|
+
|
|
228
|
+
## 1.3.0
|
|
229
|
+
|
|
230
|
+
See [https://legendapp.com/open-source/state/experiments/](https://legendapp.com/open-source/state/experiments/) for details about the new features in this version.
|
|
231
|
+
|
|
232
|
+
- Feat: Ability to globally add functions/properties to observables
|
|
233
|
+
- Feat: (experimental) `enableDirectAccess` enables a property on observables named $ as a shorthand for get/set
|
|
234
|
+
- Feat: (experimental) `enableReactUse` enables a `use()` function on all observables to get the value of an observable and track it for changes within a React component
|
|
235
|
+
- Feat: (experimental) `enableReactDirectRender` replaces `enableLegendStateReact` (will be deprecated in a later version)
|
|
236
|
+
- Fix: `afterBatch` was running after all recursive batches rather than just the current batch
|
|
237
|
+
- Fix: Circular reference detection was failing on null values
|
|
238
|
+
|
|
239
|
+
## 1.2.11
|
|
240
|
+
|
|
241
|
+
- Fix: detection of circular references was having false positives if references existed in multiple places in the hierarchy
|
|
242
|
+
- Fix: Crash in proxy trap with nested calls to assign (part 2)
|
|
243
|
+
|
|
244
|
+
## 1.2.10
|
|
245
|
+
|
|
246
|
+
- Fix: Crash in proxy trap with nested calls to assign
|
|
247
|
+
|
|
248
|
+
## 1.2.9
|
|
249
|
+
|
|
250
|
+
- Perf: A small optimization in For to skip Object.assign if there's no itemProps
|
|
251
|
+
- Perf: Change merge of pending data on load to use setAtPath instead of mergeIntoObservable
|
|
252
|
+
- Misc: Add some warnings when setting an observable directly
|
|
253
|
+
|
|
254
|
+
## 1.2.8
|
|
255
|
+
|
|
256
|
+
- Fix: Remove peerDependencies which was causing issues in some environments
|
|
257
|
+
|
|
258
|
+
## 1.2.7
|
|
259
|
+
|
|
260
|
+
- Fix: Potential crash in persistence if pathTypes comes from persistence undefined
|
|
261
|
+
|
|
262
|
+
## 1.2.6
|
|
263
|
+
|
|
264
|
+
- Fix: _arr in fieldTransforms not working for strings
|
|
265
|
+
|
|
266
|
+
## 1.2.5
|
|
267
|
+
|
|
268
|
+
- Fix: peerDependencies to make next optional
|
|
269
|
+
|
|
270
|
+
## 1.2.4
|
|
271
|
+
|
|
272
|
+
- Types: Fix types of Switch so that it works better with booleans
|
|
273
|
+
|
|
274
|
+
## 1.2.3
|
|
275
|
+
|
|
276
|
+
- Types: Fix types of Map get so that it returns an Observable of the correct type
|
|
277
|
+
|
|
278
|
+
## 1.2.2
|
|
279
|
+
|
|
280
|
+
- Fix: When persisting, changes to a node are ignored if a later change modifies a parent node (as can happen when deleting nodes)
|
|
281
|
+
|
|
282
|
+
## 1.2.1
|
|
283
|
+
|
|
284
|
+
- Feat: Support Map in the For component
|
|
285
|
+
- Change: TrackingType "optimize" parameter is changed to a symbol to avoid conflict with Map get. It will still work for now, but please `import { optimize } from "@legendapp/state"` and use that instead.
|
|
286
|
+
- Change: The For component's `eachValues` prop is deprecated in favor of just working with the `each` prop. It will still work for now, but please change `eachValues` to `each`.
|
|
287
|
+
|
|
288
|
+
## 1.2.0
|
|
289
|
+
|
|
290
|
+
- Feat: Added support for observable Map, WeakMap, Set, WeakSet
|
|
291
|
+
|
|
292
|
+
## 1.1.0
|
|
293
|
+
|
|
294
|
+
- Perf: Listeners are batched uniquely so that each listener will fire only once for all of the changes within a batch
|
|
295
|
+
- Change: Array filter and find return the observable instead of the raw data.
|
|
296
|
+
|
|
297
|
+
## 1.0.0
|
|
298
|
+
|
|
299
|
+
After an unexpectly large number of changes while in RC, 1.0 includes tons of improvements and fixes that can broadly be categorized as:
|
|
300
|
+
|
|
301
|
+
- Improved persistence plugin system
|
|
302
|
+
- Added two-way `computed`
|
|
303
|
+
- Performance improvements
|
|
304
|
+
- A few minor breaking changes - see https://legendapp.com/open-source/state/migrating/
|
|
305
|
+
|
|
306
|
+
See https://legendapp.com/open-source/legend-state-v1/ for more details.
|
|
307
|
+
|
|
308
|
+
## 1.0.0-rc.34
|
|
309
|
+
|
|
310
|
+
- Fix: Reactive FlatList `data$` prop was not working correctly #66
|
|
311
|
+
|
|
312
|
+
## 1.0.0-rc.33
|
|
313
|
+
|
|
314
|
+
- Perf: Improve performance of arrays
|
|
315
|
+
- Perf: Improve performance of useSelector when passing an observable directly
|
|
316
|
+
- Perf: Improve performance of the For component
|
|
317
|
+
|
|
318
|
+
## 1.0.0-rc.32
|
|
319
|
+
|
|
320
|
+
- Change: `useObserve` runs the function less often
|
|
321
|
+
- Change: `when` checks truthiness instead of readiness. Use `whenReady` if you want empty objects and arrays to not count.
|
|
322
|
+
- Change: `afterBatch` runs after the batch instead of at the end of a batch, which is more useful
|
|
323
|
+
- Perf: Changes are internally batched by node instead of by listener, resulting in fewer `onChange` calls
|
|
324
|
+
|
|
325
|
+
## 1.0.0-rc.31
|
|
326
|
+
|
|
327
|
+
- Feat: Add a sortValues function to For for use with eachValues
|
|
328
|
+
|
|
329
|
+
## 1.0.0-rc.30
|
|
330
|
+
|
|
331
|
+
- Feat: Add support for a _keyExtractor field to return an arbitrary key value on arrays
|
|
332
|
+
- Change: internals is exported as an object instead of a separate export path
|
|
333
|
+
|
|
334
|
+
## 1.0.0-rc.29
|
|
335
|
+
|
|
336
|
+
- Fix: Prevent batches from running recursively
|
|
337
|
+
- Fix: The second "reaction" paremeter in `observe` sometimes had an incorrect `previous` value
|
|
338
|
+
|
|
339
|
+
## 1.0.0-rc.27
|
|
340
|
+
|
|
341
|
+
- Fix: `getPrevious()` in onChange was sometimes incorrect during a batch
|
|
342
|
+
|
|
343
|
+
## 1.0.0-rc.26
|
|
344
|
+
|
|
345
|
+
- Perf: Removed IndexedDB preloader because it's actually slower because of the time it takes to copy the data across the Web Worker bridge
|
|
346
|
+
|
|
347
|
+
## 1.0.0-rc.23
|
|
348
|
+
|
|
349
|
+
- Perf: Miscellaneous micro-optimizing
|
|
350
|
+
|
|
351
|
+
## 1.0.0-rc.22
|
|
352
|
+
|
|
353
|
+
- Feat: Add a useObservableNextRouter hook for Next.js
|
|
354
|
+
- Perf: Persistence plugins queue into a microtask to bundle saves together
|
|
355
|
+
|
|
356
|
+
## 1.0.0-rc.21
|
|
357
|
+
|
|
358
|
+
- Feat: Added `eachValues` prop to For to map the values of an object
|
|
359
|
+
|
|
360
|
+
## 1.0.0-rc.20
|
|
361
|
+
|
|
362
|
+
- Fix: useSelector now uses useSyncExternalStore under the hood to support Suspense better
|
|
363
|
+
|
|
364
|
+
## 1.0.0-rc.19
|
|
365
|
+
|
|
366
|
+
- Fix: mergeIntoObservable was sometimes deleting undefined fields
|
|
367
|
+
|
|
368
|
+
## 1.0.0-rc.17
|
|
369
|
+
|
|
370
|
+
- Perf: Sped up IndexedDB plugin and removed the preloader because it was actually slower
|
|
371
|
+
|
|
372
|
+
## 1.0.0-rc.16
|
|
373
|
+
|
|
374
|
+
- Fix: Fast Refresh sometimes resetting observables -By @GiFarina
|
|
375
|
+
|
|
376
|
+
## 1.0.0-rc.14
|
|
377
|
+
|
|
378
|
+
- Perf: Running notifications in large objects sped up
|
|
379
|
+
|
|
380
|
+
## 1.0.0-rc.10
|
|
381
|
+
|
|
382
|
+
- Fix: `afterBatch` was not working correctly if run from within a batch
|
|
383
|
+
|
|
384
|
+
## 1.0.0-rc.4
|
|
385
|
+
|
|
386
|
+
- Feature: Added two way `computed`
|
|
387
|
+
|
|
388
|
+
## 1.0.0-rc.2
|
|
389
|
+
|
|
390
|
+
- Feature: `batch` has a new `onComplete `batch(callback, onComplete)` parameter to run a function after the batch commits. This can be useful for cleaning up a temporary state while batching.
|
|
391
|
+
- Fix: onChange with `initial` option fires immediately rather than going through batching process
|
|
392
|
+
- Fix: Applying pending changes on load was writing back to local persistence unnecessarily
|
|
393
|
+
- Perf: Improve performance of `mergeIntoObservable` by just doing a `set` if a target property is empty and doesn't need merging logic
|
|
394
|
+
- Perf: Improve persistence overall by using more targeted approaches than `mergeIntoObservable`
|
|
395
|
+
|
|
396
|
+
## 1.0.0-rc.1
|
|
397
|
+
|
|
398
|
+
- Fix: Incrementing a value from 0 with a function (`value.set((prev) => prev + 1)`) was not firing a callback the first time
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
## 1.0.0-rc.0
|
|
402
|
+
|
|
403
|
+
- Breaking: `onChange` function changed to take an options object as a second parameter with a new `initial` option that makes it fire immediately with the current value.
|
|
404
|
+
- Breaking: `onChange` callback receives an object parameter instead of many arguments. This adds more flexibility for callers who care about different values in the change object.
|
|
405
|
+
- Fix: `mergeIntoObservable` was not working correctly in some edge cases.
|
|
406
|
+
- Fix: IndexedDB persistence improved for many edge cases, with some fixes and performance improvements
|
|
407
|
+
- Fix: Persistence layers overall improved with more stability and better performance
|
|
408
|
+
|
|
409
|
+
## 0.23.1
|
|
410
|
+
|
|
411
|
+
- Fix: Not notifying on change of dates
|
|
412
|
+
|
|
413
|
+
## 0.23.0
|
|
414
|
+
|
|
415
|
+
- Breaking: Improved the criteria of when to notify up parents for changes on objects to run only when something inside it has changed, so setting/assigning the same object onto itself will not notify. It's unlikely but possible that may be a breaking change for you if you depended on things re-computing/re-rendering even if nothing changed.
|
|
416
|
+
- Breaking: Removed automatically treating DOM nodes and React elements as opaque objects - it added most likely unnecessary extra code and is easily solved in a more generic way. If you're storing those in observables, wrap them in `opaqueObject(...)`.
|
|
417
|
+
- Feature: Added `is*` functions to export
|
|
418
|
+
- Perf: Batching was never clearing its safety timeouts, so thousands of changes at once could have been slow
|
|
419
|
+
|
|
420
|
+
### Persistence
|
|
421
|
+
- Breaking: Changed ignoreKeys to be an array to be easier to use
|
|
422
|
+
- Breaking: Remove the flexibility for saving arrays and basic objects (can do that with itemID now).
|
|
423
|
+
- Feature: IndexedDB supports adjustData, prefixID, itemID, fieldTransforms
|
|
424
|
+
- Fix: IndexedDB `loadTable` not being considered loaded if no data was available
|
|
425
|
+
- Fix: Tons of miscellaneous IndexedDB fixes
|
|
426
|
+
|
|
427
|
+
## 0.22.5
|
|
428
|
+
|
|
429
|
+
### Persistence
|
|
430
|
+
- Fix: There was no way to subscribe to updates of dateModified
|
|
431
|
+
|
|
432
|
+
## 0.22.4
|
|
433
|
+
|
|
434
|
+
- Change: When returns the value directly, rather than a Promise, if it's already resolved on the first run
|
|
435
|
+
|
|
436
|
+
### Persistence
|
|
437
|
+
- Fix: mergeIntoObservable not working if source object has only symbol keys
|
|
438
|
+
|
|
439
|
+
## 0.22.3
|
|
440
|
+
|
|
441
|
+
- Fix: Not notifying on array change with the same length but ids added or removed
|
|
442
|
+
|
|
443
|
+
## 0.22.2
|
|
444
|
+
|
|
445
|
+
### Persistence
|
|
446
|
+
- Fix: IndexedDB preloader not loading correctly if it has to await the promise
|
|
447
|
+
|
|
448
|
+
## 0.22.1
|
|
449
|
+
|
|
450
|
+
### Persistence
|
|
451
|
+
- Fix: Changes deep in an object were not saving to IndexedDB correctly
|
|
452
|
+
- Fix: Metadata not saving properly from remote changes
|
|
453
|
+
|
|
454
|
+
## 0.22.0
|
|
455
|
+
|
|
456
|
+
- Breaking: Local Storage is no longer used as default persistence (to reduce build size for those not using it). Please configure persistence at the beginning of your application: https://legendapp.com/open-source/state/persistence/
|
|
457
|
+
- Breaking: Moved persist plugins to /persist-plugins export path
|
|
458
|
+
- Breaking: Internals of persistence plugins were changed to better support async loading and metadata. If you had made your own persistence plugin the changes should be straightforward, or create an Issue and we'll help migrate it.
|
|
459
|
+
- Breaking: `when` behavior tweaked to not be triggered by empty objects or empty arrays
|
|
460
|
+
- Feature: `ObservablePersistIndexedDB` for persisting to IndexedDB
|
|
461
|
+
- Fix: `useObserveEffect` not working right in React StrictMode
|
|
462
|
+
- Types: Improved typing of `For`
|
|
463
|
+
|
|
464
|
+
## 0.21.18
|
|
465
|
+
|
|
466
|
+
- Fix: `getObservableIndex` not working on index 0
|
|
467
|
+
- Fix: `useObserve` not working properly in StrictMode in React 18
|
|
468
|
+
|
|
469
|
+
## 0.21.17
|
|
470
|
+
|
|
471
|
+
- Fix: `useObservableQuery` was causing re-renders when using mutation
|
|
472
|
+
|
|
473
|
+
## 0.21.16
|
|
474
|
+
|
|
475
|
+
- Fix: `useObservableQuery` still not working right in StrictMode
|
|
476
|
+
|
|
477
|
+
## 0.21.15
|
|
478
|
+
|
|
479
|
+
- Fix: `useObservableQuery` not working in StrictMode
|
|
480
|
+
|
|
481
|
+
## 0.21.14
|
|
482
|
+
|
|
483
|
+
- Feat: Added `useObserveEffect`
|
|
484
|
+
- Fix: Added useReducer overriding to `createObservableHook`
|
|
485
|
+
|
|
486
|
+
## 0.21.13
|
|
487
|
+
|
|
488
|
+
- Feat: Added a `usePersistedObservable` hook
|
|
489
|
+
- Feat: Added an optional second parameter to observe for an untracked callback function
|
|
490
|
+
- Feat: Added helpers: `pageHash` and `pageHashParams` (replaces `useHash`)
|
|
491
|
+
- Fix: `useObservableQuery` was sometimes not working because it was not loading the correct Context
|
|
492
|
+
- Types: Improved types for strict mode
|
|
493
|
+
|
|
494
|
+
## 0.21.12
|
|
495
|
+
|
|
496
|
+
- Feat: For remote persistence plugins: Add options to disable local or remote sync, support loading remote even if there's no local
|
|
497
|
+
|
|
498
|
+
## 0.21.11
|
|
499
|
+
|
|
500
|
+
- Feat: Added useObservableQuery hook
|
|
501
|
+
- Feat: Added local persistence options, starting with mmkv configuration
|
|
502
|
+
- Change: Removed persist option from useObservable. It was a bad idea - it imported the whole /persist export. A better solution will come in an update soon.
|
|
503
|
+
|
|
504
|
+
## 0.21.10
|
|
505
|
+
|
|
506
|
+
- Fix: `createObservableHook` was not working with initialState as a function
|
|
507
|
+
- Perf: Reduce number of renders by not notifying if setting with an unchanged object or array
|
|
508
|
+
|
|
509
|
+
## 0.21.9
|
|
510
|
+
|
|
511
|
+
- Fix: A circular import warning in the react export
|
|
512
|
+
|
|
513
|
+
## 0.21.8
|
|
514
|
+
|
|
515
|
+
- Fix: `useSelector` was not cleaning up when components when components re-rendered from a source other than observables
|
|
516
|
+
- Types: Improved types for strict mode https://github.com/LegendApp/legend-state/pull/56
|
|
517
|
+
|
|
518
|
+
## 0.21.7
|
|
519
|
+
|
|
520
|
+
- Feat: Added another way to use the `Switch` component, with multiple `Show` children, that renders the first `Show` that matches
|
|
521
|
+
- Types: Improved types for strict mode https://github.com/LegendApp/legend-state/pull/52
|
|
522
|
+
|
|
523
|
+
## 0.21.6
|
|
524
|
+
|
|
525
|
+
- Feat: Added `opaqueObject` to make an element in an observable act as a primitive, not proxying its properties or notifying for changes.
|
|
526
|
+
- Feat: Added some helpers: `observableFetch`, `currentTime`, `currentDay`
|
|
527
|
+
- Feat: Added some hooks: `useFetch`, `useHash`, `useHover`, `useIsMounted`, `useMeasure`
|
|
528
|
+
|
|
529
|
+
## 0.21.5
|
|
530
|
+
|
|
531
|
+
- Feat: Add `getObservableIndex` function to use with the observable argument to `For`
|
|
532
|
+
|
|
533
|
+
## 0.21.4
|
|
534
|
+
|
|
535
|
+
- Fix: `reactive` was overriding the given function, causing problems if wrapping an external component and conditionally rendering the original component
|
|
536
|
+
- Fix: `useObservableReducer` was not working with non-function arguments
|
|
537
|
+
|
|
538
|
+
## 0.21.3
|
|
539
|
+
|
|
540
|
+
- Fix: History not saving the initial object creation
|
|
541
|
+
- Fix: Crash when modifying an array was that included as initial value to an observable
|
|
542
|
+
|
|
543
|
+
## 0.21.2
|
|
544
|
+
|
|
545
|
+
- Fix: React Native Switch was not two-way binding properly
|
|
546
|
+
|
|
547
|
+
## 0.21.1
|
|
548
|
+
|
|
549
|
+
- Feat: Added a deps array to useComputed so it can be updated if dependencies change
|
|
550
|
+
- Feat: Added reactive types for SVGs
|
|
551
|
+
|
|
552
|
+
## 0.21.0
|
|
553
|
+
|
|
554
|
+
See https://legendapp.com/open-source/state/migrating for more details.
|
|
555
|
+
|
|
556
|
+
- Breaking: Changed observable `onChange` callback to take an array of changes rather than a single changed value because batched changes were only showing the most recently changed child value.
|
|
557
|
+
- Breaking: Rename react-components export from legend to Legend
|
|
558
|
+
- Feat: `trackHistory` creates an observable that tracks a version history of a target observable
|
|
559
|
+
- Feat: persistObservable caches pending changes offline so if they're not successfully saved remotely, it attempts to sync them after remote persistence is loaded
|
|
560
|
+
- Feat: Allow mergeIntoObservables to delete by using a symbol
|
|
561
|
+
|
|
562
|
+
## 0.20.5
|
|
563
|
+
|
|
564
|
+
- Fix: Types of React Native components were not supporting refs properly
|
|
565
|
+
|
|
566
|
+
## 0.20.4
|
|
567
|
+
|
|
568
|
+
- Fix: Reactive components not forwarding refs properly
|
|
569
|
+
|
|
570
|
+
## 0.20.3
|
|
571
|
+
|
|
572
|
+
- Fix: Tracing functions crashing if component is not an observer
|
|
573
|
+
|
|
574
|
+
## 0.20.2
|
|
575
|
+
|
|
576
|
+
- Fix: mergeIntoObservable was overwriting object children with undefined values
|
|
577
|
+
|
|
578
|
+
## 0.20.1
|
|
579
|
+
|
|
580
|
+
- Fix: `observer` was not auto-memoizing after the rewrite in 0.20.0
|
|
581
|
+
- Fix: `For` which a child function auto-observes
|
|
582
|
+
|
|
583
|
+
## 0.20.0
|
|
584
|
+
|
|
585
|
+
- Breaking: Changed behavior of `observe` and `useObserve` so that they have a callback parameter, useful for observing an event and doing something only when it changes. It also has a new `previous` parameter to compare to the previous run which depends on a return value, so the previous behavior using the return value is moved into the callback parameter. If you were returning false to cancel observing, you can now use `e.cancel = true`. And if you were returning a cleanup function you can use `e.onCleanup = () => ...`. It also adds a `num` param to know how many times it's run.
|
|
586
|
+
- Breaking: Renamed event `dispatch` to `fire`
|
|
587
|
+
- Breaking: Removed deprecated hooking into internal dispatcher
|
|
588
|
+
- Breaking: Removed deprecated Bindable components
|
|
589
|
+
- Feat: Added a callback parameter to `useObserve`, useful for observing an event and doing something only when it changes
|
|
590
|
+
- Feat: Added useMount and useUnmount lifecycle hooks to encourage getting away from useEffect
|
|
591
|
+
- Feat: `useObserve` has a second callback parameter which will run after the selector. This can be useful for passing an `observable` or `event` as the first parameter.
|
|
592
|
+
- Fix: `reactive` and `observe` components were sometimes not retaining their static properties (like id). They now use a Proxy wrapper instead of an HOC, which reduces component tree depth and avoids any other bugs from wrapping components and forwarding refs.
|
|
593
|
+
- Fix: `event` was not working correctly in selectors
|
|
594
|
+
- Fix: The two-way binding components are always controlled, even if the `value$` is undefined
|
|
595
|
+
- Types: Improved types of `computed` and `useComponent` to accept a Promise
|
|
596
|
+
|
|
597
|
+
## 0.19.8
|
|
598
|
+
|
|
599
|
+
- Fix: Reactive components were sometimes not working in React Native https://github.com/LegendApp/legend-state/issues/32
|
|
600
|
+
|
|
601
|
+
## 0.19.7
|
|
602
|
+
|
|
603
|
+
- Feat: Added `itemProps` to `For` component to pass extra props to items
|
|
604
|
+
- Fix: Setter functions on primitives are auto-bound so you can pass them to event handlers
|
|
605
|
+
- Fix: Directly rendering primitive observables was erroring in getNode sometimes
|
|
606
|
+
|
|
607
|
+
## 0.19.6
|
|
608
|
+
|
|
609
|
+
- Feat: Observable booleans have a `toggle()` function
|
|
610
|
+
- Perf: Observable primities are a simple function instead of a class, reducing code size and should be a bit faster
|
|
611
|
+
- Types: Improved typings of For component
|
|
612
|
+
|
|
613
|
+
## 0.19.5
|
|
614
|
+
|
|
615
|
+
- Fix: Persisting primitives
|
|
616
|
+
|
|
617
|
+
## 0.19.4
|
|
618
|
+
|
|
619
|
+
- Feat: Added `useObservableReducer` hook, which is the same as `useReducer` but it updates an observable rather than triggering a render https://github.com/LegendApp/legend-state/issues/20
|
|
620
|
+
|
|
621
|
+
## 0.19.3
|
|
622
|
+
|
|
623
|
+
- Fix: Fast Refresh not disposing `observe()` correctly https://github.com/LegendApp/legend-state/issues/25
|
|
624
|
+
- Fix: React hooks error in Show when toggling if it has a children function
|
|
625
|
+
- Types: Improved types of For to handle computed observables better
|
|
626
|
+
- Types: Improved types of useObservable to support Promises
|
|
627
|
+
|
|
628
|
+
## 0.19.2
|
|
629
|
+
|
|
630
|
+
- Feat: `createObservableHook` for converting other hooks that use `useState` to return an observable
|
|
631
|
+
|
|
632
|
+
## 0.19.1
|
|
633
|
+
|
|
634
|
+
- Feat: Support two-way binding multiple props, starting with checked$ on input
|
|
635
|
+
|
|
636
|
+
## 0.19.0
|
|
637
|
+
|
|
638
|
+
This is a big one, with a breaking change to stop observing all React components automatically. See https://legendapp.com/open-source/state/migrating for more details.
|
|
639
|
+
|
|
640
|
+
- Breaking: No longer observing all React components automatically. Please use `observer` or `useSelector` for observable tracking.
|
|
641
|
+
- Breaking: Primitives no longer have `value` - use the standard `get()` or `set()` instead
|
|
642
|
+
- Breaking: Removed `get(false)` in favor of `peek()`
|
|
643
|
+
- Deprecated: Bindable components will be phased out in favor of new reactive components. Import `{ legend }` on web or `{ Legend }` on react-native instead of Bindable.
|
|
644
|
+
- Feat: Added `observer` HOC component
|
|
645
|
+
- Feat: `reactive` components that let you pass an observable or selector to any prop [reactive-props](https://legendapp.com/open-source/state/reactive-props)
|
|
646
|
+
- Feat: `useSelector` has options to control how often it renders and to reuse forceRender functions
|
|
647
|
+
- Fix: Improved types for TypeScript strict mode
|
|
648
|
+
- Fix: Local storage persistence removes item if undefined
|
|
649
|
+
- Fix: Rendering multiple obseravbles inside one element had key collision issues
|
|
650
|
+
|
|
651
|
+
## 0.18.8
|
|
652
|
+
- Fix: Array move detection further improved
|
|
653
|
+
|
|
654
|
+
## 0.18.7
|
|
655
|
+
- Feat: `observe` function can return false to prevent tracking
|
|
656
|
+
- Fix: Tracking was sometimes getting out of order with nested components and computed
|
|
657
|
+
- Fix: useSelector was triggering renders multiple times
|
|
658
|
+
- Fix: Array move detection was incorrect on inserts
|
|
659
|
+
|
|
660
|
+
## 0.18.6
|
|
661
|
+
- Fix: React-specific props were creating proxies unnecessarily
|
|
662
|
+
|
|
663
|
+
## 0.18.4
|
|
664
|
+
- Fix: Fast refresh issues with bindable components
|
|
665
|
+
|
|
666
|
+
## 0.18.3
|
|
667
|
+
- Fix: Fast refresh issues with direct rendering
|
|
668
|
+
|
|
669
|
+
## 0.18.2
|
|
670
|
+
- Fix: Rendering directly to JSX was not activating computeds
|
|
671
|
+
- Types: Improved typing of observable and useObservable to more correctly narrow down complex types
|
|
672
|
+
|
|
673
|
+
## 0.18.1
|
|
674
|
+
- Fix: Crash in Switch component in development
|
|
675
|
+
|
|
676
|
+
## 0.18.0
|
|
677
|
+
- Breaking: Renamed tracing functions to `use*` to match hook naming
|
|
678
|
+
- Fix: Improved automatic React hooking into dispatcher to not need a `useEffect` and more dependably cleanup
|
|
679
|
+
- Fix: Better handling JSX and DOM elements in observables
|
|
680
|
+
- Fix: Tracing functions were not always working correctly
|
|
681
|
+
- Fix: Errors building in Next.js
|
|
682
|
+
- Fix: Typing of Show component with Babel plugin enabled
|
|
683
|
+
- Feat: Support `computed` with a Promise
|
|
684
|
+
|
|
685
|
+
## 0.17.6
|
|
686
|
+
- Fix: React behavior disabled until it's activated by React rendering it
|
|
687
|
+
|
|
688
|
+
## 0.17.5
|
|
689
|
+
- Fix: Missing export of `useSelector`
|
|
690
|
+
|
|
691
|
+
## 0.17.4
|
|
692
|
+
- Fix: Improve `observe()` disposing
|
|
693
|
+
|
|
694
|
+
## 0.17.3
|
|
695
|
+
- Fix: Undefined observables were not rendering directly in React properly
|
|
696
|
+
- Fix: `observe()` was not updating listeners on each run
|
|
697
|
+
|
|
698
|
+
## 0.17.2
|
|
699
|
+
- Fix: Typo in mergeIntoObservable
|
|
700
|
+
|
|
701
|
+
## 0.17.1
|
|
702
|
+
- Fix: Wrapped React hook injection in try/catch because it was sometimes causing errors like when hydrating in Next.js
|
|
703
|
+
|
|
704
|
+
## 0.17.0
|
|
705
|
+
|
|
706
|
+
This is a big one, with mainly a breaking change to how primitives work, so see https://legendapp.com/open-source/state/migrating for more details.
|
|
707
|
+
|
|
708
|
+
- Breaking: Primitives in state are now returned as observable objects like everything else, and you can use `get()` or `.value` to access/modify the value
|
|
709
|
+
- Breaking: Removed `obs()` function
|
|
710
|
+
- Breaking: `set()` no longer has a keyed version because it's not needed now that we can dot through undefined nodes
|
|
711
|
+
- Breaking: Renamed `useComputed` to `useSelector`
|
|
712
|
+
- Feature: Because primitives are returned as observables, we can now dot through undefined nodes
|
|
713
|
+
- Feature: Added `peek()` function, which is the same as `get(false)`
|
|
714
|
+
- Feature: `useComputed` returns a `computed` observable
|
|
715
|
+
- Feature: `useObserve` creates an `observe` context
|
|
716
|
+
- Feature: `computed` is now lazy and won't activate until its value is accessed for the first time
|
|
717
|
+
- Feature: `Show` has a `wrap` prop to wrap children, for example with <AnimatePresence>
|
|
718
|
+
- Feature: Allow observable with no parameters, initialized to undefined
|
|
719
|
+
- Feature: `verifyNotTracking()` to make sure that components never re-render
|
|
720
|
+
- Perf: Observables created as primitives use a class instead of a Proxy, to speed up the scenario of using tons of primitive observables
|
|
721
|
+
- Perf: Listeners that don't care about the value (like observe and React components) skip passing all the parameters to callbacks
|
|
722
|
+
- Fix: The new `enableLegendStateReact()` is more stable and works better with nested components
|
|
723
|
+
- Fix: Rendering observables directly is more stable, especially in React Native
|
|
724
|
+
- Fix: Modifying listeners in an `observe` was sometimes causing infinite loops
|
|
725
|
+
|
|
726
|
+
## 0.16.1
|
|
727
|
+
- Fix: A component going from tracking nodes to not tracking nodes was causing errors
|
|
728
|
+
|
|
729
|
+
## 0.16.0
|
|
730
|
+
|
|
731
|
+
See https://legendapp.com/open-source/state/migrating for more details.
|
|
732
|
+
|
|
733
|
+
- Breaking: Removed `observer` HOC
|
|
734
|
+
- Feat: No longer need `observer` HOC - Call `enableLegendStateReact()` at the beginning of your app, and then all components automatically observe any accessed state
|
|
735
|
+
- Feat: `when` callback receives the current value as the parameter
|
|
736
|
+
- Feat: Add join to array functions that create shallow listeners
|
|
737
|
+
|
|
738
|
+
## 0.15.3
|
|
739
|
+
- Feat: Observables can easily switch back and forth between being an object or a primitive, and observable primitives have less overhead
|
|
740
|
+
|
|
741
|
+
## 0.15.2
|
|
742
|
+
- Fix: Crash when creating an observable starting undefined
|
|
743
|
+
|
|
744
|
+
## 0.15.1
|
|
745
|
+
- Fix: Assigning an object with function children
|
|
746
|
+
|
|
747
|
+
## 0.15.0
|
|
748
|
+
|
|
749
|
+
This is a big one with many breaking (but good) changes, so see https://legendapp.com/open-source/state/migrating for more details. We're making a lot of breaking changes all once so it's not too impactful.
|
|
750
|
+
|
|
751
|
+
- Breaking: There are now three levels of safety: Unsafe, Default, Safe. "Default" is new and allows direct assignment to primitives but prevents directly assigning to everything else. The previous default behavior was "Unsafe" so you may see errors if you were directly assigning to objects/arrays/etc... Replace those with `.set(...)` or pass in `false` as the second parameter to `observable` to go back to "Unsafe" mode.
|
|
752
|
+
- Breaking: Renamed `ref()` to `obs()`
|
|
753
|
+
- Breaking: The array optimizations are now opt-in, because they can potentially have some unexpected behavior if modifying the DOM externally. You can enable them by using the `For` component with the `optimized` prop.
|
|
754
|
+
- Breaking: Replaced `shallow` with a `Tracking` namespace, to add Optimized tracking. Change `shallow` to `Tracking.shallow` to get the previous behavior, or `Tracking.optimized` on an array to get the optimized behavior.
|
|
755
|
+
- Breaking: Changed `observableBatcher` to export the batching functions directly instead of as a namespace
|
|
756
|
+
- Breaking: Removed `onChangeShallow`, `onTrue`, `onEquals`, and `onHasValue` in favor of the new `effect` and `when` which automatically track any accessed observables.
|
|
757
|
+
- Breaking: Renamed primitive observables' wrapping value from `current` to `value`.
|
|
758
|
+
- Breaking: Renamed `observableComputed` to `computed` and `observableEvent` to `event`.
|
|
759
|
+
- Breaking: Renamed the bindable components from `LS` to `Bindable` and they now export from '@legendapp/state/react-components' or '@legendapp/state/react-native-components'
|
|
760
|
+
- Feat: Observable primitives can be rendered directly in React
|
|
761
|
+
- Feat: Added `observe`, which can run arbitrary code while tracking all accessed observables.
|
|
762
|
+
- Feat: Added `when`, which can run functions when the predicate returns a truthy value.
|
|
763
|
+
- Feat: Added `Switch` component
|
|
764
|
+
- Feat: Support creating an observable with a Promise as a value, which will update itself when the promise resolves.
|
|
765
|
+
- Feat: A `lockObservable` function to prevent writes
|
|
766
|
+
- Fix: Observables with arrays at the root were not notifying listeners properly
|
|
767
|
+
- Fix: Accessing `current` (now `value`) on a primitive observable was not tracking as expected
|
|
768
|
+
- Fix: Improve types of Memo/Computed/Show components so that they require functions by default, and are expanded to not need functions when referencing the babel types.
|
|
769
|
+
|
|
770
|
+
## 0.14.5
|
|
771
|
+
- Feat: Allow passing observables directly to Show
|
|
772
|
+
- Fix: Usage of old observe() when if prop is an observable
|
|
773
|
+
|
|
774
|
+
## 0.14.4
|
|
775
|
+
- Fix: Some issues in remote persistence plugins (not yet released)
|
|
776
|
+
|
|
777
|
+
## 0.14.3
|
|
778
|
+
- Fix: Some issues in remote persistence plugins (not yet released)
|
|
779
|
+
|
|
780
|
+
## 0.14.2
|
|
781
|
+
- Fix: Old versions of React Native were crashing because of using `React.` without importing it
|
|
782
|
+
|
|
783
|
+
## 0.14.1
|
|
784
|
+
- Fix: `For` component with children re-renders with the latest children correctly
|
|
785
|
+
|
|
786
|
+
## 0.14.0
|
|
787
|
+
- Feature: A `For` component for easy rendering with array optimizations
|
|
788
|
+
- Fix: Improve performance of observer
|
|
789
|
+
- Fix: Support `_id` or `__id` field names for array optimizations
|
|
790
|
+
- Fix: Mixing shallow and non-shallow listeners in a component could have not mixed correctly
|
|
791
|
+
|
|
792
|
+
## 0.13.2
|
|
793
|
+
- Types: Renamed exported types for improved clarity
|
|
794
|
+
|
|
795
|
+
## 0.13.1
|
|
796
|
+
- Fix: Exported components were losing className/style when not using bind prop
|
|
797
|
+
|
|
798
|
+
## 0.13.0
|
|
799
|
+
- Breaking Change: Removed observe() and prop(), favoring get() and ref(). get() tracks by default and ref() does not.
|
|
800
|
+
- Feat: Support ref to a path on an undefined value
|
|
801
|
+
- Fix: A crash when calling get() on an observable with undefined parents
|
|
802
|
+
- Types: Enforce bind prop to not be a primitive
|
|
803
|
+
|
|
804
|
+
## 0.12.1
|
|
805
|
+
- Types: Improved types of exported components
|
|
806
|
+
|
|
807
|
+
## 0.12.0
|
|
808
|
+
- Feat: Allow direct assignment, with warnings to catch accidental errors, and an optional "safe" mode
|
|
809
|
+
- Feat: input components with `bind` prop that automatically binds an observable to value and onChange
|
|
810
|
+
- Feat: Support keyed ref: `obs.ref('key')`
|
|
811
|
+
- Feat: `onChange` has a `runImmediately` option
|
|
812
|
+
- Fix: `.ref()` and `.get()` inside an `observer` do reference counting so they don't untrack too aggressively
|
|
813
|
+
- Fix: `delete()` was notifying listeners with the value undefined, but the key not yet deleted
|
|
814
|
+
- Fix: `observer` was sometimes missing updates occurring between render and mount
|
|
815
|
+
|
|
816
|
+
## 0.11.0-beta.7
|
|
817
|
+
- Fix: New set option with function parameter was breaking persistence
|
|
818
|
+
- Fix: Component useEffect was getting called before observer could listen for changes
|
|
819
|
+
|
|
820
|
+
## 0.11.0-beta.6
|
|
821
|
+
- Fix: Babel plugin adds imports only once, only if not already imported
|
|
822
|
+
|
|
823
|
+
## 0.11.0-beta.5
|
|
824
|
+
- Feat: `set()` can take a function to easily compute it relative to the previous value
|
|
825
|
+
|
|
826
|
+
## 0.11.0-beta.4
|
|
827
|
+
- Feat: Added `traceListeners` and `traceUpdates` functions (exported from @legendapp/state/trace). Call them within an observer. `traceListeners` logs the path of all tracked observables, while `traceUpdates` logs details of each observable change that causes a render.
|
|
828
|
+
|
|
829
|
+
## 0.11.0-beta.3
|
|
830
|
+
- Fix: observer was not working the first time in StrictMode
|
|
831
|
+
- Fix: observer was not cleaning up old listeners when the the tracked observables changed
|