Should computed properties fire when you unload records from the store via
I’m seeing an issue where an app of mine is re-calculating some computed properties when I
unloadAll (on logout).
This recalculation is problematic because it seems to result in a race condition. Specifically in my case, I’m seeing an issue with
filterBy computed properties. The
unloadAll() triggers a recalculation, but when
filterBy tries to
get() the property from an
item I hit this error.
Assertion Failed: Cannot call get with 'someProperty' on an undefined object.
I feel like I can’t be mad at a property for recomputing when the underlying value changes. I mean, that’s what a computed property is for, right?
But I’m confused because I can’t recreate this issue in a Twiddle. In that recreation Twiddle, the CP does not recalculate when I unload the store.
I can’t tell which behavior is wrong. The twiddle which doesn’t recalculate, or my app which does recalculate. It seems I may not be alone with this confusion.
Maybe a better question, what’s the best way to unload data from the store on logout? Refresh the page? (seems a bit brute force) Unload all, but only after tearing down controllers so properties don’t recalculate? (seems excessive, but would probably solve my issue).
No worries if there’s no clear answer here, but I was curious if anyone had input on this.