function initializeStore({ annotations = [], completions = [], predictions = [], annotationHistory }) {
      const as = self.annotationStore;

      // some hacks to properly clear react and mobx structures
      as.afterReset?.();

      if (!as.initialized) {
        as.initRoot(self.config);
        if (isFF(FF_LSDV_4620_3_ML) && !appControls?.isRendered()) {
          appControls?.render();
        }
      }

      // goal here is to deserialize everything fast and select only first annotation
      // no extra processes during eserialization and further processes triggered during select
      if (self.simpleInit) {
        window.STORE_INIT_OK = false;

        // add predictions and annotations to the store;
        // `hidden` will stop them from calling any rendering helpers;
        // correct annotation will be selected at the end and everything will be called inside.
        predictions.forEach((p) => {
          const obj = as.addPrediction(p);
          const results = p.result.map((r) => ({ ...r, origin: "prediction" }));

          obj.deserializeResults(results, { hidden: true });
        });

        [...completions, ...annotations].forEach((c) => {
          const obj = as.addAnnotation(c);

          obj.deserializeResults(c.draft || c.result, { hidden: true });
        });

        window.STORE_INIT_OK = true;
        // simple logging to detect if simple init is used on users' machines
        console.log("LSF: deserialization is finished");

        // next line might be unclear after removing FF_SIMPLE_INIT
        // reversing the list caused problems before when task is reloaded and list is reversed again.
        // AnnotationsCarousel has its own ordering anyway, so we just keep technical order
        // as simple as possible.
        const current = as.annotations.at(-1);
        const currentPrediction = !current && as.predictions.at(-1);

        if (current) {
          as.selectAnnotation(current.id);
          // looks like we still need it anyway, but it's fast and harmless,
          // and we only call it once on already visible annotation
          current.reinitHistory();
        } else if (currentPrediction) {
          as.selectPrediction(currentPrediction.id);
        }

        // annotation history is set when annotation is selected,
        // so no need to set it here
      } else {
        (predictions ?? []).forEach((p) => {
          const obj = as.addPrediction(p);

          as.selectPrediction(obj.id);
          obj.deserializeResults(
            p.result.map((r) => ({
              ...r,
              origin: "prediction",
            })),
          );
        });

        [...(completions ?? []), ...(annotations ?? [])]?.forEach((c) => {
          const obj = as.addAnnotation(c);

          as.selectAnnotation(obj.id);
          obj.deserializeResults(c.draft || c.result);
          obj.reinitHistory();
        });

        const current = as.annotations.at(-1);

        if (current) current.setInitialValues();

        self.setHistory(annotationHistory);
      }

      if (!self.initialized) {
        self.initialized = true;
        getEnv(self).events.invoke("storageInitialized", self);
      }
    }
Function to initialize annotation store
Given annotations and predictions
`completions` is a fallback for old projects; they'll be saved as `annotations` anyway