|
@@ -441,6 +441,7 @@ type UpdateNodeResult =
|
|
async function updateSubtree(ctx: UpdateContext, root: Ref) {
|
|
async function updateSubtree(ctx: UpdateContext, root: Ref) {
|
|
setCellStatus(ctx, root, 'processing');
|
|
setCellStatus(ctx, root, 'processing');
|
|
|
|
|
|
|
|
+ let isNull = false;
|
|
try {
|
|
try {
|
|
const start = now();
|
|
const start = now();
|
|
const update = await updateNode(ctx, root);
|
|
const update = await updateNode(ctx, root);
|
|
@@ -451,10 +452,13 @@ async function updateSubtree(ctx: UpdateContext, root: Ref) {
|
|
setCellStatus(ctx, root, 'ok');
|
|
setCellStatus(ctx, root, 'ok');
|
|
ctx.results.push(update);
|
|
ctx.results.push(update);
|
|
if (update.action === 'created') {
|
|
if (update.action === 'created') {
|
|
|
|
+ isNull = update.obj === StateObject.Null;
|
|
ctx.parent.events.log.next(LogEntry.info(`Created ${update.obj.label} in ${formatTimespan(time)}.`));
|
|
ctx.parent.events.log.next(LogEntry.info(`Created ${update.obj.label} in ${formatTimespan(time)}.`));
|
|
} else if (update.action === 'updated') {
|
|
} else if (update.action === 'updated') {
|
|
|
|
+ isNull = update.obj === StateObject.Null;
|
|
ctx.parent.events.log.next(LogEntry.info(`Updated ${update.obj.label} in ${formatTimespan(time)}.`));
|
|
ctx.parent.events.log.next(LogEntry.info(`Updated ${update.obj.label} in ${formatTimespan(time)}.`));
|
|
} else if (update.action === 'replaced') {
|
|
} else if (update.action === 'replaced') {
|
|
|
|
+ isNull = update.obj === StateObject.Null;
|
|
ctx.parent.events.log.next(LogEntry.info(`Updated ${update.obj.label} in ${formatTimespan(time)}.`));
|
|
ctx.parent.events.log.next(LogEntry.info(`Updated ${update.obj.label} in ${formatTimespan(time)}.`));
|
|
}
|
|
}
|
|
} catch (e) {
|
|
} catch (e) {
|
|
@@ -464,6 +468,10 @@ async function updateSubtree(ctx: UpdateContext, root: Ref) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // Do not continue the updates if the object is null
|
|
|
|
+ // TODO: set the states to something "nicer"?
|
|
|
|
+ if (isNull) return;
|
|
|
|
+
|
|
const children = ctx.tree.children.get(root).values();
|
|
const children = ctx.tree.children.get(root).values();
|
|
while (true) {
|
|
while (true) {
|
|
const next = children.next();
|
|
const next = children.next();
|
|
@@ -497,7 +505,7 @@ async function updateNode(ctx: UpdateContext, currentRef: Ref): Promise<UpdateNo
|
|
} else {
|
|
} else {
|
|
const oldParams = oldTree.transforms.get(currentRef)!.params;
|
|
const oldParams = oldTree.transforms.get(currentRef)!.params;
|
|
|
|
|
|
- const updateKind = !!current.obj
|
|
|
|
|
|
+ const updateKind = !!current.obj && current.obj !== StateObject.Null
|
|
? await updateObject(ctx, currentRef, transform.transformer, parent, current.obj!, oldParams, transform.params)
|
|
? await updateObject(ctx, currentRef, transform.transformer, parent, current.obj!, oldParams, transform.params)
|
|
: Transformer.UpdateResult.Recreate;
|
|
: Transformer.UpdateResult.Recreate;
|
|
|
|
|