Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
untrack(() => {
ret = this._getter!.call(obj, keyName);
});
}
if (this._dependentKeys !== undefined) {
let tag = combine(getChainTagsForKeys(obj, this._dependentKeys));
upstreamTag = upstreamTag === undefined ? tag : combine([upstreamTag, tag]);
}
if (upstreamTag !== undefined) {
update(propertyTag!, upstreamTag);
}
setLastRevisionFor(obj, keyName, tagValue(propertyTag));
cache.set(keyName, ret);
finishLazyChains(obj, keyName, ret);
}
consume(propertyTag!);
// Add the tag of the returned value if it is an array, since arrays
// should always cause updates if they are consumed and then changed
if (Array.isArray(ret) || isEmberArray(ret)) {
consume(tagForProperty(ret, '[]'));
}
return ret;
}
export function activateObserver(target: object, eventName: string, sync = false) {
let activeObservers = getOrCreateActiveObserversFor(target, sync);
if (activeObservers.has(eventName)) {
activeObservers.get(eventName)!.count++;
} else {
let [path] = eventName.split(':');
let tag = combine(getChainTagsForKey(target, path));
activeObservers.set(eventName, {
count: 1,
path,
tag,
lastRevision: value(tag),
suspended: false,
});
}
}
_revalidate() {
if (
!this._arrangedContentIsUpdating &&
!validate(this._arrangedContentTag, this._arrangedContentRevision)
) {
this._arrangedContentIsUpdating = true;
this._updateArrangedContentArray();
this._arrangedContentIsUpdating = false;
this._arrangedContentTag = combine(getChainTagsForKey(this, 'arrangedContent'));
this._arrangedContentRevision = value(this._arrangedContentTag);
}
}
}
update(bucket: ComponentStateBucket): void {
let { component, args, argsRevision, environment } = bucket;
if (ENV._DEBUG_RENDER_TREE) {
environment.debugRenderTree.update(bucket);
}
bucket.finalizer = _instrumentStart('render.component', rerenderInstrumentDetails, component);
if (args && !validate(args.tag, argsRevision)) {
let props = processComponentArgs(args!);
bucket.argsRevision = value(args!.tag);
component[IS_DISPATCHING_ATTRS] = true;
component.setProperties(props);
component[IS_DISPATCHING_ATTRS] = false;
component.trigger('didUpdateAttrs');
component.trigger('didReceiveAttrs');
}
if (environment.isInteractive) {
component.trigger('willUpdate');
component.trigger('willRender');
}
}
export function flushAsyncObservers(shouldSchedule = true) {
if (lastKnownRevision === value(CURRENT_TAG)) {
return;
}
lastKnownRevision = value(CURRENT_TAG);
ASYNC_OBSERVERS.forEach((activeObservers, target) => {
let meta = peekMeta(target);
if (meta && (meta.isSourceDestroying() || meta.isMetaDestroyed())) {
ASYNC_OBSERVERS.delete(target);
return;
}
activeObservers.forEach((observer, eventName) => {
if (!validate(observer.tag, observer.lastRevision)) {
let sendObserver = () => {
let ret;
try {
beginPropertyChanges();
ret = this._set(obj, keyName, value);
finishLazyChains(obj, keyName, ret);
let propertyTag = tagForProperty(obj, keyName) as UpdatableTag;
if (this._dependentKeys !== undefined) {
update(propertyTag, combine(getChainTagsForKeys(obj, this._dependentKeys)));
}
setLastRevisionFor(obj, keyName, tagValue(propertyTag));
} finally {
endPropertyChanges();
}
return ret;
}