Skip to content

Commit

Permalink
FIX multiInstance on remove
Browse files Browse the repository at this point in the history
  • Loading branch information
pubkey committed Nov 27, 2024
1 parent af8abf5 commit 2517d92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
13 changes: 0 additions & 13 deletions docs-src/docs/rx-storage-opfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,6 @@ const storage = getRxStorageOPFS({

If you forget to set this and still create and use a [RxDatabase](./rx-database.md) inside of the worker, you might get the error message` or `Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')`.


## Setting `jsonPositionSize` to increase the maximum database size.

By default the `jsonPositionSize` value is set to `8` which allows the database to get up to 100 megabytes in size (per collection).
This is ok for most use cases but you might want to just increase `jsonPositionSize` to `14`.
In the next major RxDB version the default will be set to `14`, but this was not possible without introducing a breaking change.

:::note
If you have already stored data, you cannot just change the `jsonPositionSize` value because your stored binary data will not be compatible anymore.

Also there is a `opfs-big.worker.js` file that has `jsonPositionSize` set to `14` already.
:::

## OPFS in Electron, React-Native or Capacitor.js

Origin Private File System is a browser API that is only accessible in browsers. Other JavaScript like React-Native or Node.js, do not support it.
Expand Down
7 changes: 6 additions & 1 deletion src/rx-collection-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,12 @@ export async function removeCollectionStorages(
collectionName: row.collectionName,
databaseInstanceToken,
databaseName,
multiInstance: false,
/**
* multiInstance must be set to true,
* so that the storageInstance can inform other
* instances about being removed.
*/
multiInstance: true,
options: {},
schema: row.schema,
password,
Expand Down

0 comments on commit 2517d92

Please sign in to comment.