@legendapp/state 0.17.0-next.8 → 0.17.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## 0.17.0
2
+
3
+ This is a big one, with mainly a breaking change to how primitives work, so see https://legendapp.com/dev/state/migrating for more details. We're aiming for this to be the last major change before aiming towards a 1.0.
4
+
5
+ - 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
6
+ - Breaking: Removed `obs()` function
7
+ - Breaking: `set()` no longer has a keyed version because it's not needed now that we can dot through undefined nodes
8
+ - Breaking: Renamed `useComputed` to `useSelector`
9
+ - Feature: Because primitives are returned as observables, we can not dot through undefined nodes
10
+ - Feature: Added `peek()` function, which is the same as `get(false)`
11
+ - Feature: `useComputed` returns a `computed` observable
12
+ - Feature: `useObserve` creates an `observe` context
13
+ - Feature: `computed` is now lazy and won't activate until its value is accessed for the first time
14
+ - Feature: `Show` has a `wrap` prop to wrap children, for example with <AnimatePresence>
15
+ - Feature: Allow observable with no parameters, initialized to undefined
16
+ - Feature: `verifyNotTracking()` to make sure that components never re-render
17
+ - Perf: Observables created as primitives use a class instead of a Proxy, to speed up the scenario of using tons of primitive observables
18
+ - Perf: Listeners that don't care about the value (like observe and React components) skip passing all the parameters to callbacks
19
+ - Fix: The new `enableLegendStateReact()` is more stable and works better with nested components
20
+ - Fix: Rendering observables directly is more stable, especially in React Native
21
+ - Fix: Modifying listeners in an `observe` was sometimes causing infinite loops
22
+
23
+
1
24
  ## 0.16.1
2
25
  - Fix: A component going from tracking nodes to not tracking nodes was causing errors
3
26
 
@@ -21,7 +44,7 @@ See https://legendapp.com/dev/state/migrating for more details.
21
44
 
22
45
  ## 0.15.0
23
46
 
24
- This is a big one with many breaking (but good) changes, so see https://legendapp.com/dev/state/migrating for more details. We're making a lot of breaking changes all once so that we can start to stabilize towards a 1.0.
47
+ This is a big one with many breaking (but good) changes, so see https://legendapp.com/dev/state/migrating for more details. We're making a lot of breaking changes all once so it's not too impactful.
25
48
 
26
49
  - 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.
27
50
  - Breaking: Renamed `ref()` to `obs()`
package/babel.js CHANGED
@@ -17275,13 +17275,12 @@ function babel () {
17275
17275
  const name = openingElement.name.name;
17276
17276
  if (name === 'Computed' || name === 'Memo' || name === 'Show') {
17277
17277
  const children = removEmptyText(children_);
17278
+ const attrs = openingElement.attributes;
17278
17279
  if (children.length > 0 &&
17279
17280
  ((_a = children[0].expression) === null || _a === void 0 ? void 0 : _a.type) !== 'ArrowFunctionExpression' &&
17280
17281
  ((_b = children[0].expression) === null || _b === void 0 ? void 0 : _b.type) !== 'FunctionExpression') {
17281
- path.replaceWith(libExports.jsxElement(libExports.jsxOpeningElement(libExports.jsxIdentifier(name), []), libExports.jsxClosingElement(libExports.jsxIdentifier(name)), [
17282
- libExports.jsxExpressionContainer(libExports.arrowFunctionExpression([], children.length > 0
17283
- ? libExports.jsxFragment(libExports.jsxOpeningFragment(), libExports.jsxClosingFragment(), children)
17284
- : children[0])),
17282
+ path.replaceWith(libExports.jsxElement(libExports.jsxOpeningElement(libExports.jsxIdentifier(name), attrs), libExports.jsxClosingElement(libExports.jsxIdentifier(name)), [
17283
+ libExports.jsxExpressionContainer(libExports.arrowFunctionExpression([], libExports.jsxFragment(libExports.jsxOpeningFragment(), libExports.jsxClosingFragment(), children))),
17285
17284
  ]));
17286
17285
  }
17287
17286
  }