@solidjs/signals 0.11.0 → 0.11.1

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/dist/dev.js CHANGED
@@ -34,6 +34,7 @@ const REACTIVE_ZOMBIE = 1 << 5;
34
34
  const REACTIVE_DISPOSED = 1 << 6;
35
35
  const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
36
36
  const REACTIVE_SNAPSHOT_STALE = 1 << 8;
37
+ const REACTIVE_LAZY = 1 << 9;
37
38
  const STATUS_PENDING = 1 << 0;
38
39
  const STATUS_ERROR = 1 << 1;
39
40
  const STATUS_UNINITIALIZED = 1 << 2;
@@ -1237,7 +1238,7 @@ function computed(fn, initialValue, options) {
1237
1238
  _parent: context,
1238
1239
  _nextSibling: null,
1239
1240
  _firstChild: null,
1240
- _flags: REACTIVE_NONE,
1241
+ _flags: options?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
1241
1242
  _statusFlags: STATUS_UNINITIALIZED,
1242
1243
  _time: clock,
1243
1244
  _pendingValue: NOT_PENDING,
@@ -1369,6 +1370,10 @@ function read(el) {
1369
1370
  let c = context;
1370
1371
  if (c?._root) c = c._parentComputed;
1371
1372
  if (refreshing && el._fn) recompute(el);
1373
+ if (el._flags & REACTIVE_LAZY) {
1374
+ el._flags &= ~REACTIVE_LAZY;
1375
+ recompute(el, true);
1376
+ }
1372
1377
  if (c && tracking) {
1373
1378
  if (el._fn && el._flags & REACTIVE_DISPOSED) recompute(el);
1374
1379
  link(el, c);