github buiapp/reaktiv 0.21.2

6 hours ago

Fixed

  • BREAKING: Restored weakref behavior for Effects that was accidentally removed in the August 2025 rewrite. Effects are now properly garbage collected when not assigned to a variable, as documented.

⚠️ Migration Warning

If you were relying on Effects persisting without storing a reference, your code will break.

Previously buggy behavior:

# Effect stayed alive even without assignment (BUG)
Effect(lambda: print(signal()))
signal.set(1)  # This worked, but shouldn't have

Correct behavior (0.21.2+):

# Effect is immediately GC'd without assignment
Effect(lambda: print(signal()))
signal.set(1)  # Effect won't run - already garbage collected

# Store reference to keep Effect alive
effect = Effect(lambda: print(signal()))
signal.set(1)  # Works correctly

Action required: Search your codebase for Effect( and ensure all Effects are either:

  1. Assigned to a variable: self.effect = Effect(...)
  2. Stored in a collection: self.effects.append(Effect(...))
  3. Properly disposed when done: effect.dispose()

This change prevents memory leaks in patterns like nested Effects and is consistent with the documented behavior.

Added

  • Added __del__ method to Effect class to automatically run cleanup functions when Effects are garbage collected, preventing resource leaks even without explicit dispose() calls.

Full Changelog: 0.21.1...0.21.2

Don't miss a new reaktiv release

NewReleases is sending notifications on new releases.