Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
Chrome deleting indexeddb randomly

I am building an application which makes heavy use of indexedDB. I am using code structure as follows:

Base class:

    class BaseDB {
        constructor(options) {
            this.version = options.version;
            this.dbName = options.dbName;
        }
    
        async open() {
            return new Promise((resolve, reject) => {
                let req = indexedDB.open(this.dbName, this.version);
                    req.onsuccess = (e) => {
                        Log(TAG, "open.onsuccess");
                        this.db = req.result
                        resolve(0)
                    };
    
                    req.onerror = (e) => {
                        Log(TAG, "open.onerror");
                        reject(e.target.errorCode);
                    };
    
                    req.onupgradeneeded = (evt) => {
                        this.onUpgrade(evt);
                    };
            })
        }
        //other common methods below ..

    }

Other classes inherit from base class:

    class ConnectionDB extends BaseDB {
        constructor(options) {
            options.dbName = DB_NAME;
            super(options);
            this.store = "connections";
        }
    
        onUpgrade(e) {
            Log(TAG, "open.onupgradeneeded");
            var store = e.currentTarget.result.createObjectStore(
                this.store, { keyPath: 'id', autoIncrement: true });
            store.createIndex(CONNECTION_INDEX, ["name"], { unique: true });
        }

        //other methods below ..
    }

I make use of the classes as follows:

async init() {    
        this.connectionDb = new ConnectionDB({version: 1});
        await this.connectionDb.open();
}

The version is hardcoded at the moment and I have not changed it since the beginning.

Everything works perfectly. But every now and then I find all my indexedDB data gets deleted. This happens only in Chrome and (at least until now) not in other browsers. I noticed that chrome has recently began to ask me to create a "profile". I suspect this problem of indexedDB started happening around the same time, but I am not entirely sure. I want to know if I am doing something wrong in my code, which may cause the db to be deleted in some cases, or is it something to do with Chrome?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda