sometimes ng returns orm objects on start, sometimes not

feat/orm-diffs
Laurin Weger 1 day ago
parent ce82867563
commit 294ad71b7c
No known key found for this signature in database
GPG Key ID: 9B372BB0B792770F
  1. 15
      sdk/js/signals/src/connector/ormConnectionHandler.ts

@ -69,8 +69,9 @@ export class OrmConnection<T extends BaseType> {
this.resolveReady = resolve; this.resolveReady = resolve;
}); });
ngSession.then(({ ng, session }) => { ngSession.then(async ({ ng, session }) => {
console.log("ng and session", ng, session); console.log("Creating orm connection. ng and session", ng, session);
await new Promise((resolve) => setTimeout(resolve, 2000));
try { try {
ng.orm_start( ng.orm_start(
(scope.length == 0 (scope.length == 0
@ -153,6 +154,11 @@ export class OrmConnection<T extends BaseType> {
}; };
private handleInitialResponse = (initialData: any) => { private handleInitialResponse = (initialData: any) => {
console.debug(
"[handleInitialResponse] handleInitialResponse called with",
initialData
);
// Assign initial data to empty signal object without triggering watcher at first. // Assign initial data to empty signal object without triggering watcher at first.
this.suspendDeepWatcher = true; this.suspendDeepWatcher = true;
batch(() => { batch(() => {
@ -162,7 +168,10 @@ export class OrmConnection<T extends BaseType> {
for (const newItem of recurseArrayToSet(initialData)) { for (const newItem of recurseArrayToSet(initialData)) {
this.signalObject.add(newItem); this.signalObject.add(newItem);
} }
console.log("data received", this.signalObject); console.log(
"[handleInitialResponse] signal object:",
this.signalObject
);
}); });
queueMicrotask(() => { queueMicrotask(() => {

Loading…
Cancel
Save