Problem Statement
When a collection is cleared using Onyx.clear() (e.g., clearing all report_ keys), useOnyx subscriptions to individual collection member keys (e.g., report_123) fail to recalculate and return the correct/newest value. The subscription value remains stale.
Expected Behaviour
After Onyx.clear() is called, all useOnyx hooks subscribed to collection member keys should be notified and re-render with the updated (cleared) values.
Actual Behavior
useOnyx works correctly with regular key subscriptions after Onyx.clear(), but not with collection member key subscriptions. The subscriber receives stale data instead of being properly notified of the change.
Root Cause Analysis
During Onyx.clear(), collection data is being notified through a different code path. Faulty logic is clearing the collection data from the cache before it can be used during the notify logic execution, which causes the useOnyx subscriber to not be properly notified of the change.
Reproduction
A failing unit test demonstrating this issue is available in:
Related
Issue Owner
Current Issue Owner: @kadiealexander
Problem Statement
When a collection is cleared using
Onyx.clear()(e.g., clearing allreport_keys),useOnyxsubscriptions to individual collection member keys (e.g.,report_123) fail to recalculate and return the correct/newest value. The subscription value remains stale.Expected Behaviour
After
Onyx.clear()is called, alluseOnyxhooks subscribed to collection member keys should be notified and re-render with the updated (cleared) values.Actual Behavior
useOnyxworks correctly with regular key subscriptions afterOnyx.clear(), but not with collection member key subscriptions. The subscriber receives stale data instead of being properly notified of the change.Root Cause Analysis
During
Onyx.clear(), collection data is being notified through a different code path. Faulty logic is clearing the collection data from the cache before it can be used during the notify logic execution, which causes theuseOnyxsubscriber to not be properly notified of the change.Reproduction
A failing unit test demonstrating this issue is available in:
Related
Issue Owner
Current Issue Owner: @kadiealexander