From 7a637365ad2d468d78ea853c3aa6b651b1341895 Mon Sep 17 00:00:00 2001 From: Max Bo Date: Thu, 9 Jan 2025 16:38:40 +1100 Subject: [PATCH] delete var --- celine/deno.json | 2 +- celine/mod.ts | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/celine/deno.json b/celine/deno.json index 5947f0b..bacbd11 100644 --- a/celine/deno.json +++ b/celine/deno.json @@ -1,6 +1,6 @@ { "name": "@celine/celine", - "version": "4.2.0", + "version": "4.3.0", "exports": "./mod.ts", "tasks": { "dev": "deno run --watch mod.ts" diff --git a/celine/mod.ts b/celine/mod.ts index 209819a..4084698 100644 --- a/celine/mod.ts +++ b/celine/mod.ts @@ -175,13 +175,11 @@ export class CelineModule { maybeDefinition?: Definition ): void { const observer = observerVisibility === "visible" ? this.observer(name) : undefined - const variable = this.module._scope.get(name) || - this.module.variable(observer); - // if you declare B before A such that B depends on A - // I _think_ the Observable runtime declares a sort of "pseudeo-variable" for A - // which does not have an Observer attached to it - // Thus, we need to force the Observer to be attached to the variable - variable._observer = observer; + const variable = this.module._scope.get(name) || this.module.variable(observer); + + if (Symbol.keyFor(variable._observer) == 'no-observer' && observerVisibility) { + variable.delete(); + } const inputs: Inputs = Array.isArray(inputsOrDefinition) ? inputsOrDefinition