Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Justin Francos
    @jfrancos
    Hi @pubkey, after calling database.remove(), all IndexDB databases are removed except for one called "_pouch_documentdb-rxdb-0-documents-local", which seems to hold some information about the latest pullDocument/pushSequence. Is this intentional? Now when a user logs out, I do
    await (await getDatabase()).remove();
    (await indexedDB.databases())
      .filter(({ name }) => name.startsWith('_pouch'))
      .map(({ name }) => indexedDB.deleteDatabase(name));
    This seems to do the trick to let the documents repopulate when a user logs back in and the database is recreated. Is there something more natural that we ought to be doing to actually delete all the databases, instead of all-but-one? Or is there some alternative set of steps that ought to be done when we want to remove user-data from the browser due to the user logging out?
    Justin Francos
    @jfrancos
    @plmercereau see above for my more heavy-handed method for dealing with the lingering last-pulled-document info. I'm curious to know what reasoning there is behind leaving that one database remaining, but without that info, just deleting the whole thing feels like the best move
    Daniel Meyer
    @pubkey
    This is a bug. The lastPullDocument should be deleted with the database. I am on holiday right now, sorry for not responding. PR is welcomed.
    Justin Francos
    @jfrancos
    I'm having a mysterious issue that I'm hoping someone can help me with. Whenever I remove() and then recreate a collection, operations on that collection seem to work but also give me an error saying Error: primary missing !!. I'm noticing one other issue that I assume is related, which is that an observation on a query of that collection, does not have its initial execution called.
    Both of these things work fine the first time I create the collection: operations on the collection run without an error, and the initial instance of an observation query is successfully run.
    haspr
    @hasprLLP
    RxError (DOC18): RxError (DOC18):
    RxError (COL19): RxError (COL19)
    what are these error for
    Justin Francos
    @jfrancos
    @pubkey re my Error: primary missing !! issue -- I went into my node_modules and added console.log(change) to addEventToChangeStream in rx-storage-pouchdb. I'm seeing that when I add a collection, remove it, and then add it again (a collection of the same name), addEventToChangeStream gets run twice whenever I e.g. insert a document. The change dict in both instances of a single insert call are identical except that the first one shows a doc.collectionName property set to undefined. I take this to mean that there's some sort of rxjs observation that continues to occur for a collection that has been removed, which is causing problems. I've been looking through rx-database to try and see where observations are initiated and perhaps removed, but haven't been able to figure that out yet. Any hints on how to continue appreciated.
    Daniel Meyer
    @pubkey
    Can you make a PR wirh a failing test?
    Justin Francos
    @jfrancos
    @pubkey The call to insert succeeds (i.e. it is not throwing, it's just that the error appears in the console from some resulting observation (I think?)), so it isn't clear right away how I'd create a failing test. But I will try to come up with something.
    Justin Francos
    @jfrancos
    Hi @pubkey, can you give some kind of clue on the mechanism that's involved here, to help me figure out how to make a test case? Can you let me know if you agree with my interpretation of what I'm observing, namely "I take this to mean that there's some sort of rxjs observation that continues to occur for a collection that has been removed, which is causing problems." And if so, should I be able to observe something about whether there are rxjs observations persisting when they shouldn't, by looking at the destroyed collection (e.g. collection.$)
    Daniel Meyer
    @pubkey
    Do you use the pouchdb replication?
    Justin Francos
    @jfrancos
    The most confusing thing about all this for me is that even if I destroy the database with the collection, and make sure there's nothing in application storage, and recreate the db along with a collection with the same name, this problem still appears
    I'm using graphql replication, but I've disabled replication while I'm trying to figure this out. I.e. the problem still happens with no replication
    Screen Shot 2021-09-12 at 5.51.38 PM.png
    ^ in case it's useful
    Daniel Meyer
    @pubkey
    Can you set multiInstance: false
    Justin Francos
    @jfrancos
    Also, the whole point of what I'm trying to do here is clear user data from the browser for when a user logs out, so if there's a better more standard way of doing this, that would work too
    Justin Francos
    @jfrancos
    I set multiInstance to false and it didn't seem to change anything
    Justin Francos
    @jfrancos
    Thanks for that bug-checklist.
    @pubkey In the process of doing all the things in the checklist, I noticed that the problem (mysteriously) goes away simply in virtue of having import { PouchDB } from 'rxdb';. Even if I don't then reference PouchDB. Why is that fixing this?
    Daniel Meyer
    @pubkey
    I have no idea
    this does not make sense to me
    which bundler do you use?
    Justin Francos
    @jfrancos
    using snowpack
    Daniel Meyer
    @pubkey
    how did you import the other rxdb things?
    Justin Francos
    @jfrancos
    ```
    Daniel Meyer
    @pubkey
    hmm
    I have no idea what this could be
    Justin Francos
    @jfrancos
    import { RxDBValidatePlugin } from 'rxdb/plugins/validate';
    import { addRxPlugin, createRxDatabase } from 'rxdb/plugins/core';
    import { addPouchPlugin, getRxStoragePouch } from 'rxdb/plugins/pouchdb';
    import {
      RxDBReplicationGraphQLPlugin,
      pullQueryBuilderFromRxSchema,
      pushQueryBuilderFromRxSchema,
      graphQLSchemaFromRxSchema,
    } from 'rxdb/plugins/replication-graphql';
    import idb from 'pouchdb-adapter-idb';
    Daniel Meyer
    @pubkey
    does import * as foobar from 'rxdb' also fix the issue?
    as soon as you import from the rxdb default, you automatically import all plugins
    so it looks like this starts any sideEffect which should not change anything
    but it does
    Justin Francos
    @jfrancos
    Okay so what I was observing was that the error message stopped happening ... but also other things were not quite right, like observed queries were not working. Figured out I need to import PouchDB before everything else - now I get the error, but things are otherwise working.
    I've done all the steps of the debug checklist except for the memory plugin, which I'll do now
    Justin Francos
    @jfrancos
    memory *adapter
    Justin Francos
    @jfrancos
    I'm having trouble getting the memory adapter to work, keep getting "Cannot set property 'needReadable' of undefined"
    Also I'm not seeing anything useful in the pouchdb debug messages
    Can you let me know if you agree with my interpretation of what I'm observing, namely "I take this to mean that there's some sort of rxjs observation that continues to occur for a collection that has been removed, which is causing problems." And if so, should I be able to observe something about whether there are rxjs observations persisting when they shouldn't, by looking at the destroyed collection (e.g. collection.$)
    snookyly
    @snookyly

    Hey there, I am facing an issue with adding collection and data. Here's the createRxDatabase:
    const db: RxDatabase = await createRxDatabase({
    name: './data/server-db',
    storage: getRxStoragePouch('websql'),
    ignoreDuplicate: true,
    });

    then I add a collection with
    await db.addCollections({
    items: {
    schema: mySchema
    }
    });
    and add insert an document with:
    await db.items.upsert(....);

    But there seems to be a problem that the collection will not be properly created. I cannot browse the collection by http://localhost/db/items. It says "no_db_file". Any ideas? Your help is highly appreciated.

    Justin Francos
    @jfrancos
    @pubkey Thanks for talking to me about this. I submitted a PR with a failing test.
    Ebuka
    @ebukaodini
    Please I need dark mode for these docs :(
    snookyly
    @snookyly
    Using:
    const db: RxDatabase = await createRxDatabase({
    name: 'db',
    storage: getRxStoragePouch('websql'),
    it will work. Seems to be still the issue with the subfolder in the name under typescript. See: https://github.com/snookyly/rxdb-filefolder
    Jimmy Merrild Krag
    @beruic