Skip to content

Commit 2eee73e

Browse files
committed
[Update] formats: added as new module, moved out of ui
1 parent 17610ca commit 2eee73e

8 files changed

Lines changed: 430 additions & 104 deletions

File tree

src/js/select/cells.js

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function normalizeSelectionPath(path) {
5252
? []
5353
: Array.isArray(path)
5454
? path
55-
: [path]
55+
: [path];
5656
}
5757

5858
function selectionPathKey(path) {
@@ -784,23 +784,23 @@ class Derivation extends Reactive {
784784
_apply(value, publish = true) {
785785
const token = ++this._promiseToken;
786786
const isPromise = !!(value && typeof value.then === "function");
787-
if (isPromise) {
788-
this.isPending = true;
789-
if (publish) {
790-
this.revision++;
791-
this.pub(value, Nothing, this);
792-
}
793-
value.then(
794-
(resolved) => {
795-
if (token !== this._promiseToken) {
796-
return;
787+
if (isPromise) {
788+
this.isPending = true;
789+
if (publish) {
790+
this.revision++;
791+
this.pub(value, Nothing, this);
792+
}
793+
value.then(
794+
(resolved) => {
795+
if (token !== this._promiseToken) {
796+
return;
797797
}
798-
this.previous = this.value;
799-
this.value = resolved;
800-
this.isPending = false;
801-
this.revision++;
802-
this.pub(resolved, Nothing, this);
803-
},
798+
this.previous = this.value;
799+
this.value = resolved;
800+
this.isPending = false;
801+
this.revision++;
802+
this.pub(resolved, Nothing, this);
803+
},
804804
(error) => {
805805
if (token !== this._promiseToken) {
806806
return;
@@ -816,11 +816,11 @@ class Derivation extends Reactive {
816816
this.previous = this.value;
817817
this.value = value;
818818
this.isPending = false;
819-
if (publish) {
820-
this.revision++;
821-
this.pub(value, Nothing, this);
822-
}
819+
if (publish) {
820+
this.revision++;
821+
this.pub(value, Nothing, this);
823822
}
823+
}
824824

825825
// Subscribes to all reactive cells in template.
826826
bind() {
@@ -835,7 +835,7 @@ class Derivation extends Reactive {
835835
return;
836836
}
837837
const fullPath =
838-
sourcePath === undefined || sourcePath === null
838+
sourcePath === undefined || sourcePath === null || sourcePath === Nothing
839839
? path
840840
: Array.isArray(sourcePath)
841841
? [...path, ...sourcePath]
@@ -1016,7 +1016,7 @@ function effect(inputs, effector) {
10161016
for (const [cell, path] of Reactive.Walk(inputs)) {
10171017
const reactor = (_value, sourcePath, origin) => {
10181018
const fullPath =
1019-
sourcePath === undefined || sourcePath === null
1019+
sourcePath === undefined || sourcePath === null || sourcePath === Nothing
10201020
? path
10211021
: Array.isArray(sourcePath)
10221022
? [...path, ...sourcePath]
@@ -1080,10 +1080,14 @@ export {
10801080
walk,
10811081
};
10821082
export default Object.assign(cell, {
1083-
defer: deferred,
1084-
derive: derived,
1083+
derived,
1084+
deferred,
1085+
selected,
10851086
effect,
1087+
// TODO: We may want to deprecate these
10861088
select: selected,
1089+
defer: deferred,
1090+
derive: derived,
10871091
walk,
10881092
expand,
10891093
});

0 commit comments

Comments
 (0)