Skip to content

Commit

Permalink
delete var
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxwellBo committed Jan 9, 2025
1 parent 93e41cd commit 7a63736
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion celine/deno.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
12 changes: 5 additions & 7 deletions celine/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7a63736

Please sign in to comment.