CB-3056 events synchronisation (#1431)

* CB-3056 fix: link nav node info with nav tree resource

* CB-3056 fix: don't reset observable on disconnect

---------

Co-authored-by: MarinaVorobeva21 <98399603+MarinaVorobeva21@users.noreply.github.com>
This commit is contained in:
Alexey
2023-01-31 17:24:22 +03:00
committed by GitHub
co-authored by MarinaVorobeva21
parent 8440d0871c
commit 25aee8cf86
3 changed files with 9 additions and 2 deletions
@@ -91,7 +91,7 @@ export class NavNodeInfoResource extends CachedMapResource<string, NavNode> {
ResourceKeyUtils.forEach(keyObject, key => {
const metadata = this.metadata.get(key);
if (metadata.withDetails !== state) {
if (!metadata.withDetails && state) {
metadata.outdated = true;
}
metadata.withDetails = state;
@@ -111,6 +111,7 @@ export class NavTreeResource extends CachedMapResource<string, string[]> {
this.onNodeRefresh = new Executor<string>(null, (a, b) => a === b);
// navNodeInfoResource.preloadResource(this);
navNodeInfoResource.connect(this);
this.outdateResource(navNodeInfoResource);
this.updateResource(navNodeInfoResource);
this.sync(this.projectInfoResource, () => CachedMapAllKey, () => CachedMapAllKey);
@@ -44,7 +44,13 @@ implements IServerEventEmitter<TEvent, SourceEvent, TEventID, TTopic> {
this.subscribedResources = new Map();
this.subscription = null;
this.serverSubject = this.emitter.multiplex(topic, this.map);
this.eventsSubject = connectable(merge(this.subject, this.serverSubject));
this.eventsSubject = connectable(
merge(this.subject, this.serverSubject),
{
connector: () => new Subject(),
resetOnDisconnect: false, // used because subscribers won't receive events after reconnect otherwise
}
);
this.emitter.onInit.next(this.onInit);
}