realar-project / realar

5 kB Advanced state manager for React

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

low proposal: add automatic unsubscribe for previous time creations in all reaction places

betula opened this issue · comments

class A {
  @prop m;
  constructor() {
    k_signal.watch(k => this.m = k);
  }
}

k_signal.view(k => new A());

let t;
(cycle and loop)(() => {
  (await )k_signal;
  t = new A();
});

Automatic unsubscribe k_signal.watch... When? At the next iteration, but

loop(() => {
  if (await k_signal) {
    t = new A();
  }
});

In that case, automatic destroy should be not on the next iteration.

Hmmm. Declined.