when we invalidate on every subscription change, we're leaving a lot on the table.
For example, let's say i want to only invalidate a list of people editing a particular document.
That cached should only be invalidated if the document that changes has an editing field changed that either gets rid of or adds the particular taskId.
Basically, instead of saying "whenever a subscription changes, invalidate" we should say "whenever a subscription changes, run a series of callbacks & invalidate the ones that come back true."
This array (or Set) of callbacks needs to be called when a sub changes in mergeNewData.
It needs the oldVal, newVal for args. Each callback should return a boolean.
The callback needs to be attached to the subscription, either when we call the subscription (like what happens now) or calling the computed with the subscription name.
If it's called with the computed, we're unnecessarily creating a new function instance every time, since that function will need to be based off the variables that come with props & state.
So, basically we need another option on subscription called invalidate. Instead of using a Set, we'll just use an object to store that.
when we invalidate on every subscription change, we're leaving a lot on the table. For example, let's say i want to only invalidate a list of people editing a particular document. That cached should only be invalidated if the document that changes has an editing field changed that either gets rid of or adds the particular taskId.
Basically, instead of saying "whenever a subscription changes, invalidate" we should say "whenever a subscription changes, run a series of callbacks & invalidate the ones that come back true."
This array (or Set) of callbacks needs to be called when a sub changes in
mergeNewData
. It needs theoldVal, newVal
for args. Each callback should return a boolean.The callback needs to be attached to the subscription, either when we call the subscription (like what happens now) or calling the computed with the subscription name.
If it's called with the
computed
, we're unnecessarily creating a new function instance every time, since that function will need to be based off the variables that come with props & state.So, basically we need another option on subscription called
invalidate
. Instead of using a Set, we'll just use an object to store that.