mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
fix: address code review findings from pfapi-to-oplog refactor
- Update CLAUDE.md to reference /src/app/op-log/persistence/ instead
of deleted /src/app/pfapi/ directory
- Fix boolean coercion in archive-migration.service.ts (same pattern
as bug fixed in 183bf2c18 for LegacyPfDbService)
- Replace deprecated .toPromise() with firstValueFrom() in
archive.service.ts for RxJS 8 compatibility
This commit is contained in:
parent
18964320ca
commit
dd79f54c23
3 changed files with 16 additions and 12 deletions
|
|
@ -89,7 +89,7 @@ The app uses NgRx (Redux pattern) for state management. Key state slices:
|
|||
|
||||
### Data Flow
|
||||
|
||||
1. **Persistence Layer** (`/src/app/pfapi/`): Handles data storage with multiple adapters (IndexedDB)
|
||||
1. **Persistence Layer** (`/src/app/op-log/persistence/`): Handles data storage and operation logging (IndexedDB)
|
||||
2. **Services** (`*.service.ts`): Business logic and state mutations via NgRx
|
||||
3. **Components**: (`*.component.ts`) Subscribe to state via selectors, dispatch actions for changes
|
||||
4. **Effects**: Handle side effects (persistence, sync, notifications)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import { ArchiveDbAdapter } from '../../core/persistence/archive-db-adapter.serv
|
|||
import { ArchiveModel } from './archive.model';
|
||||
import { TimeTrackingState } from '../time-tracking/time-tracking.model';
|
||||
import { first } from 'rxjs/operators';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
import { selectTimeTrackingState } from '../time-tracking/store/time-tracking.selectors';
|
||||
|
||||
/**
|
||||
|
|
@ -137,10 +138,9 @@ export class ArchiveService {
|
|||
// Move all archived tasks to archiveYoung
|
||||
// Move timeTracking data to archiveYoung
|
||||
// Get time tracking from the store as it is fresher
|
||||
const timeTracking = await this._store
|
||||
.select(selectTimeTrackingState)
|
||||
.pipe(first())
|
||||
.toPromise();
|
||||
const timeTracking = await firstValueFrom(
|
||||
this._store.select(selectTimeTrackingState).pipe(first()),
|
||||
);
|
||||
const newSorted1 = sortTimeTrackingDataToArchiveYoung({
|
||||
timeTracking: timeTracking || DEFAULT_TIME_TRACKING,
|
||||
archiveYoung,
|
||||
|
|
@ -293,10 +293,9 @@ export class ArchiveService {
|
|||
// Also move historical time tracking data to archiveYoung
|
||||
// This ensures the remote client's archive matches the originating client
|
||||
// Get time tracking from the store as it is fresher
|
||||
const timeTracking = await this._store
|
||||
.select(selectTimeTrackingState)
|
||||
.pipe(first())
|
||||
.toPromise();
|
||||
const timeTracking = await firstValueFrom(
|
||||
this._store.select(selectTimeTrackingState).pipe(first()),
|
||||
);
|
||||
const sorted = sortTimeTrackingDataToArchiveYoung({
|
||||
timeTracking: timeTracking || DEFAULT_TIME_TRACKING,
|
||||
archiveYoung,
|
||||
|
|
|
|||
|
|
@ -77,13 +77,18 @@ export class ArchiveMigrationService {
|
|||
if (!archive) return false;
|
||||
|
||||
// Check for tasks
|
||||
const hasTaskData = archive.task && archive.task.ids && archive.task.ids.length > 0;
|
||||
const hasTaskData = !!(
|
||||
archive.task &&
|
||||
archive.task.ids &&
|
||||
archive.task.ids.length > 0
|
||||
);
|
||||
|
||||
// Check for time tracking data
|
||||
const hasTimeTrackingData =
|
||||
const hasTimeTrackingData = !!(
|
||||
archive.timeTracking &&
|
||||
(Object.keys(archive.timeTracking.project || {}).length > 0 ||
|
||||
Object.keys(archive.timeTracking.tag || {}).length > 0);
|
||||
Object.keys(archive.timeTracking.tag || {}).length > 0)
|
||||
);
|
||||
|
||||
return hasTaskData || hasTimeTrackingData;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue