All history version turn to blank

Today one of my yjs document turn to blank for all versions, this is the version info that store in PostgreSQL:

and this is the table ddl:

-- public.tex_sync_history definition

-- Drop table

-- DROP TABLE public.tex_sync_history;

CREATE TABLE public.tex_sync_history (
	id int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL,
	"key" varchar NOT NULL,
	value bytea NOT NULL,
	"version" varchar NOT NULL,
	content_type varchar NOT NULL,
	doc_name varchar NOT NULL,
	clock int4 NOT NULL,
	"source" varchar NOT NULL,
	created_time timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL,
	project_id varchar NOT NULL,
	CONSTRAINT tex_sync_history_unique UNIQUE (key)
);

this is how I apply the history version info:

async getYDoc(docName: string): Promise<Y.Doc> {
    const updates: Array<TeXSync> = await this.getPgBulkData(
      this.pool,
      { values: true, keys: false, reverse: false },
      docName
    );
    const ydoc = new Y.Doc();
    ydoc.transact(() => {
      try {
        for (let i = 0; i < updates.length; i++) {
          let update: TeXSync = updates[i];
          let updateVal: Uint8Array = update.value;
          Y.applyUpdate(ydoc, updateVal);
          let txt = ydoc.getText(docName);
          let txt1 = txt.toString();
          console.log(txt1);
        }
      } catch (err) {
        console.error("apply update failed", err);
      }
    });
    return ydoc;
  }
}

all the version from start to end get ‘’ . why did this happen? what should I do to fixed this issue? This is the minimal example:

it look like the same with The document becomes blank when the DB is under high load and communication fails during connection

I can only deduce from the headline that you are somehow missing content. What exactly is the error message you get. Your post seems to miss content.

If you are missing content, I suspect that you are dropping messages, which is why ydoc.store.pendingUpdates is probably populated with content (if that property is not null, you are definitely dropping updates).