Skip to content

Commit ce4c0ed

Browse files
authored
Release/17.0.0 (#7588)
* ADD ensure indexes and primaryKey have a maximum `maxLength` of `1000` * ADD use internal types for `WeakRef` so people do not have to add `ES2021.WeakRef` to their TypeScript config * REMOVE dist folder * ADD `context` field to all RxDB write errors for easier debugging * CHANGE `toggleOnDocumentVisible` is now `true` by default * CHANGE final fields no longer must be `required` * FIX types * FIX dexie * FIX * FIX `RxCollection.cleanup()` does not respect the provided `minimumDeletedTime`
1 parent 98027c8 commit ce4c0ed

4 files changed

Lines changed: 38 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
# RxDB Changelog
33

44
<!-- CHANGELOG NEWEST -->
5+
- ADD ensure indexes and primaryKey have a maximum `maxLength` of `1000`.
6+
- ADD use internal types for `WeakRef` so people do not have to add `ES2021.WeakRef` to their TypeScript config.
7+
- We no longer have the `dist` folder in the github repository. Either install RxDB from npm, or run the build scripts locally.
8+
- ADD `context` field to all RxDB write errors for easier debugging.
9+
- CHANGE `toggleOnDocumentVisible` is now `true` by default.
10+
- CHANGE final fields no longer must be `required`.
11+
- FIX OPFS-Storage memory and cleanup leaking
12+
- FIXmemory-mapped-storage: deleted docs must be purged
13+
- FIX `RxCollection.cleanup()` does not respect the provided `minimumDeletedTime`.
514

615
<!-- ADD new changes here! -->
716

orga/before-next-major.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,11 @@ https://github.com/pubkey/rxdb/issues/6810
3636

3737
https://discord.com/channels/969553741705539624/1237000453791678487/threads/1327921349808885831
3838

39-
## Move `final` definitions to the top level
40-
41-
This should be done similar to where indexes or `encryption` fields are defined. This would
42-
then allow to have `final` be also set for nested properties.
43-
4439

4540
---------------------------------
4641
## Maybe later (not sure if should be done)
4742

4843

49-
## Suggestions from #6787
50-
51-
See https://github.com/pubkey/rxdb/pull/6787
52-
53-
5444
## Do not allow type mixing
5545

5646
In the RxJsonSchema, a property of a document can have multiple types like

src/plugins/cleanup/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { runAsyncPluginHooks } from '../../hooks.ts';
21
import type {
32
RxCollection,
43
RxPlugin
@@ -19,8 +18,8 @@ export const RxDBCleanupPlugin: RxPlugin = {
1918
this.database.cleanupPolicy ? this.database.cleanupPolicy : {}
2019
);
2120

22-
if (typeof minimumDeletedTime === 'undefined') {
23-
minimumDeletedTime = cleanupPolicy.minimumDeletedTime;
21+
if (typeof minimumDeletedTime !== 'undefined') {
22+
cleanupPolicy.minimumDeletedTime = minimumDeletedTime;
2423
}
2524

2625
// run cleanup() until it returns true
@@ -43,3 +42,4 @@ export const RxDBCleanupPlugin: RxPlugin = {
4342
};
4443

4544
export * from './cleanup.ts';
45+
export * from './cleanup-helper.ts';

test/unit/cleanup.test.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
schemaObjects,
77
schemas,
88
isFastMode,
9-
HumanDocumentType
9+
HumanDocumentType,
10+
humansCollection
1011
} from '../../plugins/test-utils/index.mjs';
1112
import {
1213
createRxDatabase,
@@ -21,6 +22,7 @@ import { replicateRxCollection } from '../../plugins/replication/index.mjs';
2122

2223
import { RxDBCleanupPlugin } from '../../plugins/cleanup/index.mjs';
2324
import { wrappedValidateAjvStorage } from '../../plugins/validate-ajv/index.mjs';
25+
import { DEFAULT_CLEANUP_POLICY } from '../../plugins/cleanup/index.mjs';
2426
addRxPlugin(RxDBCleanupPlugin);
2527

2628
describeParallel('cleanup.test.js', () => {
@@ -200,6 +202,29 @@ describeParallel('cleanup.test.js', () => {
200202
});
201203
});
202204
describe('issues', () => {
205+
it('minimumDeletedTime not respected', async () => {
206+
const col = await humansCollection.create(0);
207+
208+
const storageInstance = col.storageInstance.originalStorageInstance;
209+
const cleanupBefore = storageInstance.cleanup.bind(storageInstance);
210+
211+
const calls: number[] = [];
212+
storageInstance.cleanup = (t) => {
213+
calls.push(t);
214+
return cleanupBefore(t);
215+
}
216+
217+
await col.cleanup(0);
218+
await col.cleanup(5);
219+
await col.cleanup();
220+
221+
222+
assert.strictEqual(calls[0], 0);
223+
assert.strictEqual(calls[1], 5);
224+
assert.strictEqual(calls[2], DEFAULT_CLEANUP_POLICY.minimumDeletedTime);
225+
226+
col.database.remove();
227+
});
203228
it('fields with umlauts and emojis could break the state after cleanup in some storages', async () => {
204229
type DocType = {
205230
id: string;

0 commit comments

Comments
 (0)