lowlighter / libs

🍱 Collection of carefully crafted TypeScript standalone libraries. Minimal, unbloated, convenient.
https://jsr.io/@libs
MIT License
100 stars 12 forks source link

fix: propagation of state across deep child contexts #71

Closed okikio closed 3 weeks ago

okikio commented 1 month ago

This PR addresses several key issues and improvements in the propagation and isolation of state across contexts, ensuring correct behavior with shared and isolated data. Additionally, it refines the handling of native classes, improves event firing consistency, and strengthens the test cases.

TL;DR;

High-Level Changes:

Behavioral Changes:

Why These Changes Are Necessary:

Without these changes, context propagation across deep hierarchies could fail, leading to inconsistent data between parent and child contexts. For example, modifying shared data in a child context could fail to propagate back to the parent, causing bugs in applications that rely on context sharing. Additionally, the old implementation could trigger multiple events per change, leading to performance issues and unintended behaviors.

Examples of failing use cases before this fix:

Logic and Details of Changes:

Let me know if you need further details or adjustments!

okikio commented 3 weeks ago

cc @lowlighter

lowlighter commented 3 weeks ago

Thanks a lot for your contribution !