You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but it only works by intercepting the setting of a what-would-be-@tracked property.
The situation I have is related to the URL, but the source of the data could be anything.
getlocalData(){// currentURL will invalidate for *any* URL change, // including QP-only transitions// but I want a way to discard the invalidations where the returned value// would be the same.returnthis.routerService.currentURL.split('?')[0];}
for rendering performance reasons (like, maybe something downstream, depending on localData causes other things to happen, you want those other things to execute as few times as possible -- in this case, based on value-equality rather than reference-dirtiness.
@cached is a reference-based cache, and the references do change, so it doesn't work.
What we need is something like @dedupeTracked, but for getters, and absorbing upstream changes.
@dedupeTracked// @cached + value equality checkinggetlocalData(){// ...}
Something that comes close to this is
@dedupeTracked
fromtracked-toolbox
: https://github.com/tracked-tools/tracked-toolbox/tree/master#dedupetrackedbut it only works by intercepting the setting of a what-would-be-
@tracked
property.The situation I have is related to the URL, but the source of the data could be anything.
or generically,
for rendering performance reasons (like, maybe something downstream, depending on
localData
causes other things to happen, you want those other things to execute as few times as possible -- in this case, based on value-equality rather than reference-dirtiness.@cached
is a reference-based cache, and the references do change, so it doesn't work.What we need is something like
@dedupeTracked
, but for getters, and absorbing upstream changes.I don't think ember has a way to handle this.
Starbeam does, tho. So maybe the answer is to wait for better reactivity primitives.
https://www.starbeamjs.com/guides/advanced/equivalence.html
The text was updated successfully, but these errors were encountered: