forked from trent_larson/crowd-funder-for-time-pwa
remove more debugging
This commit is contained in:
@@ -109,9 +109,6 @@ export async function retrieveSettingsForActiveAccount(): Promise<Settings> {
|
||||
const defaultSettings = await retrieveSettingsForDefaultAccount();
|
||||
// If no active DID, return defaults
|
||||
if (!defaultSettings.activeDid) {
|
||||
logConsoleAndDb(
|
||||
"[databaseUtil] No active DID found, returning default settings",
|
||||
);
|
||||
return defaultSettings;
|
||||
}
|
||||
|
||||
@@ -124,9 +121,7 @@ export async function retrieveSettingsForActiveAccount(): Promise<Settings> {
|
||||
);
|
||||
|
||||
if (!result?.values?.length) {
|
||||
logConsoleAndDb(
|
||||
`[databaseUtil] No account-specific settings found for ${defaultSettings.activeDid}`,
|
||||
);
|
||||
// we created DID-specific settings when generated or imported, so this shouldn't happen
|
||||
return defaultSettings;
|
||||
}
|
||||
|
||||
@@ -136,18 +131,6 @@ export async function retrieveSettingsForActiveAccount(): Promise<Settings> {
|
||||
result.values,
|
||||
)[0] as Settings;
|
||||
|
||||
// Debug: Check the actual data types from SQLite
|
||||
logConsoleAndDb(
|
||||
`[DEBUG] Raw SQLite data types for ${defaultSettings.activeDid}:`,
|
||||
false,
|
||||
);
|
||||
Object.entries(overrideSettings).forEach(([key, value]) => {
|
||||
logConsoleAndDb(
|
||||
`[DEBUG] - ${key}: ${typeof value} = ${JSON.stringify(value)}`,
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
const overrideSettingsFiltered = Object.fromEntries(
|
||||
Object.entries(overrideSettings).filter(([_, v]) => v !== null),
|
||||
);
|
||||
@@ -419,19 +402,11 @@ export function parseJsonField<T>(value: unknown, defaultValue: T): T {
|
||||
try {
|
||||
// If already an object (web SQLite auto-parsed), return as-is
|
||||
if (typeof value === "object" && value !== null) {
|
||||
logConsoleAndDb(
|
||||
`[DEBUG] JSON field is already an object (auto-parsed by web SQLite), skipping parse`,
|
||||
false,
|
||||
);
|
||||
return value as T;
|
||||
}
|
||||
|
||||
// If it's a string (Capacitor SQLite or fallback), parse it
|
||||
if (typeof value === "string") {
|
||||
logConsoleAndDb(
|
||||
`[DEBUG] JSON field is a string, parsing JSON (Capacitor SQLite or web fallback)`,
|
||||
false,
|
||||
);
|
||||
return JSON.parse(value) as T;
|
||||
}
|
||||
|
||||
@@ -440,11 +415,6 @@ export function parseJsonField<T>(value: unknown, defaultValue: T): T {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
// Unexpected type, log and return default
|
||||
logConsoleAndDb(
|
||||
`[DEBUG] JSON field has unexpected type: ${typeof value}, returning default`,
|
||||
true,
|
||||
);
|
||||
return defaultValue;
|
||||
} catch (error) {
|
||||
logConsoleAndDb(
|
||||
|
||||
Reference in New Issue
Block a user