fix(svelte): resolve props_invalid_value and dexie DataError
- Initialize ds_loaded properties in ae_stores.ts to fix svelte binding error. - Make db_save_ae_obj_li__ae_obj in core__idb_dexie.ts schema-aware to fix Dexie DataError when saving to tables with non-'id' primary keys.
This commit is contained in:
@@ -95,7 +95,8 @@ export async function db_save_ae_obj_li__ae_obj<T extends Record<string, any>>({
|
|||||||
return null; // Skip objects without a valid ID.
|
return null; // Skip objects without a valid ID.
|
||||||
}
|
}
|
||||||
|
|
||||||
(record as any).id = id;
|
const primary_key_name = db_table.schema.primKey.name;
|
||||||
|
(record as any)[primary_key_name] = id;
|
||||||
return record;
|
return record;
|
||||||
})
|
})
|
||||||
.filter(Boolean) as T[];
|
.filter(Boolean) as T[];
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { run, preventDefault } from 'svelte/legacy';
|
import { run, preventDefault } from 'svelte/legacy';
|
||||||
|
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
// import { liveQuery } from "dexie"; // Use this in the future???
|
// import { liveQuery } from "dexie"; // Use this in the future???
|
||||||
import { Modal } from 'flowbite-svelte';
|
import { Modal } from 'flowbite-svelte';
|
||||||
@@ -11,10 +12,11 @@
|
|||||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
import type { key_val } from '$lib/stores/ae_stores';
|
import type { key_val } from '$lib/stores/ae_stores';
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
console.log(
|
console.log(
|
||||||
`ae_e_data_store ${ds_code} account_id=${$ae_loc.account_id} for_type=${for_type} for_id=${for_id}`
|
`ae_e_data_store ${ds_code} account_id=${$ae_loc.account_id} for_type=${for_type} for_id=${for_id}`
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// export let store: string = 'local';
|
// export let store: string = 'local';
|
||||||
|
|
||||||
|
|||||||
@@ -372,7 +372,11 @@ const ae_app_session_data_defaults: key_val = {
|
|||||||
ds: {
|
ds: {
|
||||||
submit_status: null
|
submit_status: null
|
||||||
},
|
},
|
||||||
ds_loaded: {},
|
ds_loaded: {
|
||||||
|
hub__site__root_page_header: false,
|
||||||
|
hub__site__root_page_content: false,
|
||||||
|
hub__site__root_page_footer: false
|
||||||
|
},
|
||||||
|
|
||||||
files: {
|
files: {
|
||||||
disable_submit__hosted_file_obj: false,
|
disable_submit__hosted_file_obj: false,
|
||||||
@@ -380,6 +384,7 @@ const ae_app_session_data_defaults: key_val = {
|
|||||||
uploaded_file_kv: {},
|
uploaded_file_kv: {},
|
||||||
video_clip_file_kv: {},
|
video_clip_file_kv: {},
|
||||||
processed_file_list: [],
|
processed_file_list: [],
|
||||||
|
status__file_list: null,
|
||||||
// uploaded_file_list: [],
|
// uploaded_file_list: [],
|
||||||
video_clip_file_list: [],
|
video_clip_file_list: [],
|
||||||
submit_status: null, // 'saving', 'created', 'updated', 'saved'
|
submit_status: null, // 'saving', 'created', 'updated', 'saved'
|
||||||
|
|||||||
Reference in New Issue
Block a user