You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/LokiJS-Forge/LokiDB/blob/master/CONTRIBUTING.md#question
Current behavior
When you remove a collection, the 'autosave' does not pick up the change.
Expected behavior
I would expect autosave to pick up the change, so that the deletion of the collection is properly persisted.
Minimal reproduction of the problem with instructions
const idbAdapter = new IndexedStorage(dbName);
const db = new Loki('dbfile');
let persistenceOptions = {
adapter: idbAdapter,
autosave: truep,
autosaveInterval: 900, // 900ms.
autoload: true,
throttledSaves: false,
};
wdb.initializePersistence(persistenceOptions)
.then((r) => {
console.log('Done loading.');
const collection = db.addCollection(`Test_500`);
collection.insert({ foo:'bar' });
setTimeout(() => {
// So autosave has run
db.removeCollection('Test_500');
setTimeout(() => {
// so autosave has had time to do it's thing again
console.log('Collections in db:', db._collections.length);
console.log('Collections last persisted', db._persistenceAdapter._dbref._collections.length);
console.log('Check DevTools Application storage. The DB should be EMPTY.');
}, 2000);
},2000);
})
What is the motivation / use case for changing the behavior?
In my mind, deletion of data should "stick", and not show up again if the browser is refreshed. In my project I can work around it by 'clearing' a collection instead of deleting and re-creating it, but this does feel like a bug that should be tracked.
I'm submitting a...
Current behavior
When you remove a collection, the 'autosave' does not pick up the change.
Expected behavior
I would expect autosave to pick up the change, so that the deletion of the collection is properly persisted.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
In my mind, deletion of data should "stick", and not show up again if the browser is refreshed. In my project I can work around it by 'clearing' a collection instead of deleting and re-creating it, but this does feel like a bug that should be tracked.
Environment
The text was updated successfully, but these errors were encountered: