Open Finnem opened 2 years ago
The scripts are parsed by the ReactiveHTMLMetaclass
, i.e. at class definition time, so should not really be mutated at the instance level. Therefore I'm leaning towards simply replacing _scripts
with a frozendict in the metaclass.
Some of panels classes use mutable defaults in their declarations. This can lead to some unexpected behaviour. For me this happened when updating the scripts dictionary of ReactiveHTML during class initialization.
Description of expected behavior and the observed behavior
Exptected: ReactiveHTML._scripts behaves like a instance-bound attribute. Observed: ReactiveHTML._scripts is shared between all ReactiveHTML instances.
Complete, minimal, self-contained example code that reproduces the issue
Stack traceback and/or browser JavaScript console output
a.scripts: {'potato': '1'} a.scripts: {'potato': '2'}