feat(preferences): integrate PreferenceService and enhance testing capabilities
This commit refactors the PreferenceService to use named exports for better consistency and updates the DbService import accordingly. It introduces a testing mechanism for the PreferenceService by creating test windows to facilitate cross-window preference synchronization testing. Additionally, improvements are made to the usePreference hook for better performance and stability, ensuring efficient preference management in the application.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { dbService } from '@data/db/DbService'
|
||||
import { loggerService } from '@logger'
|
||||
import { DefaultPreferences } from '@shared/data/preferences'
|
||||
import type { PreferenceDefaultScopeType, PreferenceKeyType } from '@shared/data/types'
|
||||
@@ -5,7 +6,6 @@ import { IpcChannel } from '@shared/IpcChannel'
|
||||
import { and, eq } from 'drizzle-orm'
|
||||
import { BrowserWindow } from 'electron'
|
||||
|
||||
import dbService from './db/DbService'
|
||||
import { preferenceTable } from './db/schemas/preference'
|
||||
|
||||
const logger = loggerService.withContext('PreferenceService')
|
||||
@@ -296,4 +296,3 @@ export class PreferenceService {
|
||||
|
||||
// Export singleton instance
|
||||
export const preferenceService = PreferenceService.getInstance()
|
||||
export default preferenceService
|
||||
|
||||
Reference in New Issue
Block a user