Pārlūkot izejas kodu

🐛 fix again not-yet-loaded layers

jmacura 4 gadi atpakaļ
vecāks
revīzija
4e9472a8a1
1 mainītis faili ar 13 papildinājumiem un 9 dzēšanām
  1. 13 9
      src/adjuster/adjuster.service.ts

+ 13 - 9
src/adjuster/adjuster.service.ts

@@ -279,9 +279,12 @@ export class AdjusterService {
   }
 
   processIndex(codeRecordRelations: Record<string, unknown>): void {
-    if (obce.getState() !== 'ready') {
-      obce.once('featuresloadend', () =>
-        this.processIndex(codeRecordRelations)
+    if (obce.getFeatures()?.length < 1) {
+      this.hsUtilsService.debounce(
+        this.processIndex(codeRecordRelations),
+        300,
+        false,
+        this
       );
       return;
     }
@@ -316,12 +319,13 @@ export class AdjusterService {
     method: MethodDescription,
     codeRecordRelations: Record<string, unknown>
   ): void {
-    if (method.layer?.getSource().getState() !== 'ready') {
-      method.layer
-        .getSource()
-        .once('featuresloadend', () =>
-          this.processClusters(method, codeRecordRelations)
-        );
+    if (method.layer?.getSource().getFeatures()?.length < 1) {
+      this.hsUtilsService.debounce(
+        this.processClusters(method, codeRecordRelations),
+        300,
+        false,
+        this
+      );
       return;
     }
     let errs = 0;