【问题标题】:Angular 5 with RxDB (idb adaptor) threws Uncaught TypeError: winningRev is not a function error when creating databaseAngular 5 with RxDB (idb adapter) throws Uncaught TypeError:winningRev is not a function error when creating database
【发布时间】:2018-02-03 22:24:10
【问题描述】:

我正在使用带有 RxDB 7.3.2 和 pouchdb-adapter-idb 6.4.2 的 Angualr Cli 1.6.5(Angular 5.2.0)。

当我尝试创建/连接到数据库时,出现以下错误:

zone.js:192 Uncaught TypeError: winningRev is not a function
    at insertDoc (index.es.js:370)
    at nextDoc (index.es.js:449)
    at eval (index.es.js:452)
    at Map.forEach (<anonymous>)
    at processDocs (index.es.js:426)
    at idbProcessDocs (index.es.js:330)
    at checkDone (index.es.js:354)
    at IDBRequest.readMetadata [as __zone_symbol__ON_PROPERTYsuccess] (index.es.js:364)
    at IDBRequest.wrapFn (zone.js:1166)
    at ZoneDelegate.invokeTask (zone.js:421)
index-browser.es.js:486 Database has a global failure DOMException: Uncaught exception in event handler.

这是我调用的函数:

async getRxDB() {
    this.rx_db = await RxDB.create({
        name: 'testdb',
        adapter: 'idb',
        multiInstance: false
    });
    console.log(this.rx_db);

    await this.rx_db.collection({name: 'fork', schema: TestDBSchema});
}

数据库架构:

const TestDBSchema = {
    'title': 'test schema',
    'version': 0,
    'description': 'describes a simple task',
    'type': 'object',
    'properties': {
      'name': {
          'type': 'string',
          'primary': true
      }
    }

};

我只是在一个组件中调用了这个函数:

constructor(private databaseService: DatabaseService) {}

ngOnInit() {
    this.databaseService.getRxDB();
}

我在互联网上搜索过,但找不到类似的问题。 有没有遇到类似设置的这个错误?

更新 @lossleader提供的链接确实有效,谢谢

【问题讨论】:

标签: angular-cli indexeddb angular5 pouchdb pouchdb-adapter-localstorage


【解决方案1】:

PouchDB 6.4.2 随 broken es modules 一起发布,因为它被转译的 rollup 版本中存在错误。 (转译器错误从import X as Y 语法中删除了as Y,而没有重命名局部X 变量以防止阴影。)

PouchDB 6.4.3 现已发布到 npm 并使用汇总 0.55.1 进行转译,fixes the bug 因此更新应该可以解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-08-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-20
    • 1970-01-01
    • 1970-01-01
    • 2020-03-25
    • 2022-08-22
    相关资源
    最近更新 更多