Skip to content

Commit 53dbddc

Browse files
authored
runtime/js: type constructors fix (#2092)
Dont create references if type constructors are already initialized
1 parent 8a71c12 commit 53dbddc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

runtimes/js/src/runtime.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,11 @@ impl Runtime {
103103
.get_or_init(|| Ok(Arc::new(init_runtime(false)?)))
104104
.clone()?;
105105

106-
let refs = TypeConstructorRefs {
107-
decimal: env.create_reference(options.type_constructors.decimal)?,
108-
};
109-
let _ = TYPE_CONSTRUCTORS.set(refs);
106+
TYPE_CONSTRUCTORS.get_or_init(|| TypeConstructorRefs {
107+
decimal: env
108+
.create_reference(options.type_constructors.decimal)
109+
.expect("couldn't create reference to Decimal"),
110+
});
110111

111112
Ok(Self { runtime })
112113
}

0 commit comments

Comments
 (0)