forked from jsnbuchanan/crowd-funder-for-time-pwa
fix: resolve cross-platform SQLite JSON parsing inconsistencies
- Add platform-agnostic parseJsonField utility to handle different SQLite implementations - Web SQLite (wa-sqlite/absurd-sql) auto-parses JSON strings to objects - Capacitor SQLite returns raw strings requiring manual parsing - Update searchBoxes parsing to use new utility for consistent behavior - Fixes "[object Object] is not valid JSON" error when switching platforms - Ensures compatibility between web and mobile SQLite implementations Fixes: searchBoxes parsing errors in databaseUtil.ts Related: contactMethods field has similar issue (needs same treatment)
This commit is contained in:
@@ -215,7 +215,7 @@ export default class SearchAreaView extends Vue {
|
||||
if (USE_DEXIE_DB) {
|
||||
await db.open();
|
||||
await db.settings.update(MASTER_SETTINGS_KEY, {
|
||||
searchBoxes: [newSearchBox],
|
||||
searchBoxes: searchBoxes as any, // Type assertion for Dexie compatibility
|
||||
});
|
||||
}
|
||||
this.searchBox = newSearchBox;
|
||||
@@ -269,7 +269,7 @@ export default class SearchAreaView extends Vue {
|
||||
if (USE_DEXIE_DB) {
|
||||
await db.open();
|
||||
await db.settings.update(MASTER_SETTINGS_KEY, {
|
||||
searchBoxes: [],
|
||||
searchBoxes: "[]" as any, // Type assertion for Dexie compatibility
|
||||
filterFeedByNearby: false,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user