fix(idaa): resolve BB comment loop and parent mapping issues

- Switched to create_nested_obj_v3 for establishing parent-child links.
- Optimized background load trigger with untrack to prevent infinite loops.
- Resolved MySQL IntegrityError (missing post_id) during comment creation.
- Hardened view component reactivity for Svelte 5.
This commit is contained in:
Scott Idem
2026-02-05 20:10:46 -05:00
parent a3ec7f8c42
commit d6b6e988eb
2 changed files with 11 additions and 8 deletions

View File

@@ -145,6 +145,7 @@ export async function load_ae_obj_li__post_comment({
// Updated 2026-01-06
export async function create_ae_obj__post_comment({
api_cfg,
account_id,
post_id,
data_kv,
params = {},
@@ -152,6 +153,7 @@ export async function create_ae_obj__post_comment({
log_lvl = 0
}: {
api_cfg: any;
account_id: string;
post_id: string;
data_kv: key_val;
params?: key_val;
@@ -159,14 +161,16 @@ export async function create_ae_obj__post_comment({
log_lvl?: number;
}): Promise<ae_PostComment | null> {
if (log_lvl) {
console.log(`*** create_ae_obj__post_comment() *** post_id=${post_id}`);
console.log(`*** create_ae_obj__post_comment() *** account_id=${account_id} post_id=${post_id}`);
}
const result = await api.create_ae_obj_v3({
const result = await api.create_nested_obj_v3({
api_cfg,
obj_type: 'post_comment',
parent_type: 'post',
parent_id: post_id,
child_type: 'post_comment',
fields: {
post_id_random: post_id,
account_id: account_id,
...data_kv
},
params,

View File

@@ -30,16 +30,15 @@
import Comp__post_comment_obj_id_edit from './ae_idaa_comp__post_comment_obj_id_edit.svelte';
import AE_Comp_Hosted_Files_Download_Button from '$lib/ae_core/ae_comp__hosted_files_download_button.svelte';
let ae_promises: key_val = $state({});
import { untrack } from 'svelte';
$effect(() => {
const post_id = $idaa_slct.post_id;
if (post_id) {
if (post_id && post_id !== untrack(() => $idaa_trig.post_id)) {
if (log_lvl) {
console.log(`Post ID selected: ${post_id}`);
console.log(`Post Object selected: `, $lq__post_obj);
}
// Trigger background load
// Trigger background load only if it's a new ID
$idaa_trig.post_id = post_id;
}
});