Skip to content

Store is not initialised when preload is set to true #22

Description

@toddux-dopnel

There is something wrong about the preload flag logic for keyvalue stores. The way I understand the preload flag is that if set to true it will preload the data from the store so the app already have it when it is requested. preload flag is true by default so my expectation is that something like _getAllFromUrbit() must be invoked by default during the initialisation. However, the code only calls subscribeAll() and I can't see anything that change the loaded flag to true. The result is that if I call the all function immediately after the initialisation I get the endless setTimeout in waitForLoaded():

const db = await Tome.init(api);
const store = await db.keyvalue();
const result = await store.all() // this one never completes

If this is not a valid use of the library maybe the documentation can be improved to state that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions