mirror of
https://github.com/haexhub/haex-hub.git
synced 2025-12-17 06:30:50 +01:00
Fix production build crash by resolving circular import dependency
Moved database schemas from src-tauri/database/schemas/ to src/database/schemas/ to fix bundling issues and resolved circular import dependency that caused "Cannot access uninitialized variable" error in production builds. Key changes: - Moved crdtColumnNames definition into haex.ts to break circular dependency - Restored .$defaultFn(() => crypto.randomUUID()) calls - Kept AnySQLiteColumn type annotations - Removed obsolete TDZ fix script (no longer needed) - Updated all import paths across stores and configuration files
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
import { eq } from 'drizzle-orm'
|
||||
import { haexDesktopItems } from '~~/src-tauri/database/schemas'
|
||||
import { haexDesktopItems } from '~/database/schemas'
|
||||
import type {
|
||||
InsertHaexDesktopItems,
|
||||
SelectHaexDesktopItems,
|
||||
} from '~~/src-tauri/database/schemas'
|
||||
} from '~/database/schemas'
|
||||
import de from './de.json'
|
||||
import en from './en.json'
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import { asc, eq } from 'drizzle-orm'
|
||||
import {
|
||||
haexWorkspaces,
|
||||
type SelectHaexWorkspaces,
|
||||
} from '~~/src-tauri/database/schemas'
|
||||
} from '~/database/schemas'
|
||||
import type { Swiper } from 'swiper/types'
|
||||
|
||||
export type IWorkspace = SelectHaexWorkspaces
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { drizzle } from 'drizzle-orm/sqlite-proxy'
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import { schema } from '@/../src-tauri/database/index'
|
||||
import { schema } from '~/database'
|
||||
import type {
|
||||
AsyncRemoteCallback,
|
||||
SqliteRemoteDatabase,
|
||||
@ -21,11 +21,12 @@ export const useVaultStore = defineStore('vaultStore', () => {
|
||||
public: { haexVault },
|
||||
} = useRuntimeConfig()
|
||||
|
||||
const router = useRouter()
|
||||
const currentVaultId = computed<string | undefined>({
|
||||
get: () =>
|
||||
getSingleRouteParam(useRouter().currentRoute.value.params.vaultId),
|
||||
getSingleRouteParam(router.currentRoute.value.params.vaultId),
|
||||
set: (newVaultId) => {
|
||||
useRouter().currentRoute.value.params.vaultId = newVaultId ?? ''
|
||||
router.currentRoute.value.params.vaultId = newVaultId ?? ''
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import { and, eq, or, type SQLWrapper } from 'drizzle-orm'
|
||||
import {
|
||||
haexNotifications,
|
||||
type InsertHaexNotifications,
|
||||
} from '~~/src-tauri/database/schemas/haex'
|
||||
} from '~/database/schemas/haex'
|
||||
import {
|
||||
isPermissionGranted,
|
||||
requestPermission,
|
||||
@ -31,7 +31,12 @@ export const useNotificationStore = defineStore('notificationStore', () => {
|
||||
}
|
||||
|
||||
const checkNotificationAsync = async () => {
|
||||
isNotificationAllowed.value = await isPermissionGranted()
|
||||
try {
|
||||
isNotificationAllowed.value = await isPermissionGranted()
|
||||
} catch (error) {
|
||||
console.warn('Notification permission check failed:', error)
|
||||
isNotificationAllowed.value = false
|
||||
}
|
||||
return isNotificationAllowed.value
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { and, eq } from 'drizzle-orm'
|
||||
import { z } from 'zod'
|
||||
import * as schema from '@/../src-tauri/database/schemas/haex'
|
||||
import * as schema from '~/database/schemas/haex'
|
||||
import type { Locale } from 'vue-i18n'
|
||||
|
||||
export enum VaultSettingsTypeEnum {
|
||||
|
||||
Reference in New Issue
Block a user