LokiJS icon indicating copy to clipboard operation
LokiJS copied to clipboard

Error: this collection cannot be loaded lazily

Open tomkennedy22 opened this issue 2 years ago • 2 comments

Hey all, running in to a problem, would love some guidance.

I'm using the incremental indexeddb adapter created by @radex . I've had success with Vanilla Loki - as well as with the normal IndexedDB adapter, but really like the look of the Incremental Adapter.

I have about 20 collections, of varying sizes. All of them have the following settings:

  1. a proto define to inflate on load
  2. lazyLoad: true
  3. clone: true
  4. clone_method: shallow-assign
  5. The collection name is in the adapter options list for "lazyCollections".

I've tried this setup with all of the lazy settings turned off - both in individual collections and the adapter definition.

I'm at a bit of a loss on how to proceed. I've combed through all of the code that leads to that line, but can't figure out how to get my data loaded from idb for some of my collections. Notably, not all collections have this issue.

Thanks!

tomkennedy22 avatar Jan 07 '23 01:01 tomkennedy22

@tomkennedy22 I can't answer the problem off the top of my head, but my Loki usage is all here: https://github.com/Nozbe/WatermelonDB/blob/master/src/adapters/lokijs/worker/DatabaseDriver.js (and generally in the lokijs) catalog - maybe that helps you somehow in understanding how I use IncrementalIndexedDB

radex avatar Jan 10 '23 14:01 radex

Thanks for the response @radex. I've read through WatermelonDB, and I think it makes sense how you approach it. It might take me a few days/weeks to re-visit my code and figure out the gap, as I tabled the incremental-idb change for the time being. Thanks for the help! I'll reach out again if needed.

tomkennedy22 avatar Jan 10 '23 14:01 tomkennedy22