@legendapp/state 3.0.0-alpha.0 → 3.0.0-alpha.2

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