Skip to content

Commit e6de866

Browse files
committed
fix(state): address code quality review comments on PR #3286
- remove unused ProfileManager import in app-react-state-replication/App.tsx - remove unused AppModulesInitializedEvent import in AppConfigurator.ts - remove unused 'type' from event destructuring in StateProvider.ts - export PouchDbSyncStorage class - add revs_limit and size options to PouchDbStorageOptions
1 parent 8d9f5b1 commit e6de866

5 files changed

Lines changed: 15 additions & 5 deletions

File tree

cookbooks/app-react-state-replication/src/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { ProfileManager } from './components/ProfileManager';
21
import Router from './Router';
32

43
/**

packages/app/src/AppConfigurator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import type { HttpClientMsal } from '@equinor/fusion-framework-module-http/clien
1818

1919
import auth from '@equinor/fusion-framework-module-msal';
2020

21-
import type { AppEnv, AppModules, AppModulesInstance } from './types';
22-
import { AppModulesConfiguredEvent, AppModulesInitializedEvent } from './events';
21+
import type { AppEnv, AppModules } from './types';
22+
import { AppModulesConfiguredEvent } from './events';
2323
import { AppConfiguratorError } from './error';
2424
import { deepClone, deepFreeze, type DeepImmutable } from './utils';
2525

packages/modules/state/src/StateProvider.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ function applyStateChangeEvents<T extends AllowedValue = AllowedValue>(
334334
// Accumulate changes using scan operator, starting with the initial array
335335
scan((acc, event) => {
336336
const {
337-
type,
338337
detail: { key, item },
339338
} = event;
340339

packages/modules/state/src/storage/PouchDbStorage.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ const STORAGE_KEY_SEPARATOR = '::';
2929
*/
3030
export type PouchDbStorageOptions = PouchDB.Configuration.DatabaseConfiguration & {
3131
key_prefix?: string;
32+
/**
33+
* Number of old revisions to keep for each document.
34+
* Lower values reduce storage usage at the cost of revision history.
35+
*/
36+
revs_limit?: number;
37+
/**
38+
* Maximum local database size in megabytes.
39+
* Important for Safari (IndexedDB quota enforcement).
40+
* Valid values: 10, 50, 100, 500, 1000.
41+
*/
42+
size?: number;
3243
};
3344

3445
/**
@@ -554,7 +565,7 @@ export class PouchDbStorage implements IStorage, Disposable {
554565

555566
// Try to get existing document for update, fallback to creation template
556567
// This pattern handles both create and update operations seamlessly
557-
const existingDoc = await this.#db.get(key).catch((e) => {
568+
const existingDoc = await this.#db.get(key).catch((_e) => {
558569
// Document doesn't exist - create template for new document
559570
// _rev: undefined tells PouchDB this is a new document
560571
return { _id: key, _rev: undefined };

packages/modules/state/src/storage/PouchDbSyncStorage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type PouchDbSyncStorageOptions = {
1515
syncOptions: PouchDB.Replication.SyncOptions;
1616
};
1717

18+
// biome-ignore lint/correctness/noUnusedVariables: intentionally internal — not yet tested or integrated into the public API
1819
class PouchDbSyncStorage extends PouchDbStorage {
1920
#remoteDb: PouchDB.Database;
2021
#syncOptions: PouchDB.Replication.SyncOptions;

0 commit comments

Comments
 (0)