Skip to content

[hmr] meaning of dispose 🤔 #556

@CNSeniorious000

Description

@CNSeniorious000

Motivations:

  1. Although an effect is reusable after dispose, a manual call is needed to activate it.
  2. For an async primitive, if you dispose it before ongoing recomputation finishes, dependencies be re-added after that

Consider:

  1. Maybe setting call_immediately to False by default and ensure "first call" in __enter__.
    1. A new flag _is_first_time is needed. This is acceptable and would improve the warning message for reactivity_loss_strategy
    2. We can await the first call in async primitives' __aenter__ hook, which is very Pythonic to me
  2. What's the cases when people want to stop and reuse a BaseComputation later? Why don't they just construct a new one (which should not be very expensive). If it is expensive, maybe we can add a pause and resume method to cover those cases. Dependencies can be retained during the pausing period.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions