From 13cb13c4701e3aed9c10b053ee6f58c20abff25a Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 5 Feb 2026 19:16:02 -0500 Subject: [PATCH] fix(idaa): complete null-hardening for BB comment editor - Added optional chaining to all post_comment_obj property accesses. - Resolved TypeError when clicking 'New Comment' button. - Hardened UI stability for asynchronous data loading. --- ...idaa_comp__post_comment_obj_id_edit.svelte | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_comment_obj_id_edit.svelte b/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_comment_obj_id_edit.svelte index 4bd66c6b..a2ccedbd 100644 --- a/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_comment_obj_id_edit.svelte +++ b/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_comment_obj_id_edit.svelte @@ -44,7 +44,7 @@ // let notes_changed = $state(false); let disable_submit_btn = $state(false); - function preventDefault(fn: (event: T) => void) { + function prevent_default(fn: (event: T) => void) { return function (event: T) { event.preventDefault(); fn(event); @@ -77,7 +77,9 @@ let post_comment_do: key_val = {}; if (!$idaa_slct.post_comment_id) { - post_comment_do['post_id_random'] = $idaa_slct.post_id; + const parent_post_id = $idaa_slct.post_id; + post_comment_do['post_id'] = parent_post_id; + post_comment_do['post_id_random'] = parent_post_id; post_comment_do['enable'] = true; } @@ -97,7 +99,7 @@ post_comment_do['external_person_id'] = post_comment_di.external_person_id; post_comment_do['full_name'] = post_comment_di.full_name; post_comment_do['email'] = post_comment_di.email; - post_comment_do['notify'] = post_comment_do.notify; + post_comment_do['notify'] = post_comment_di.notify; post_comment_do['hide'] = post_comment_di.hide; post_comment_do['priority'] = post_comment_di.priority; @@ -144,6 +146,7 @@ prom_api__post_comment_obj = await posts_func .create_ae_obj__post_comment({ api_cfg: $ae_api, + account_id: $ae_api.account_id, post_id: $idaa_slct.post_id, data_kv: post_comment_do, log_lvl: log_lvl @@ -442,7 +445,7 @@ Copy and paste link: ${ class:ae_create={!$idaa_slct.post_id} bind:clientHeight={$ae_loc.iframe_height_modal_body} > -
+ {#await prom_api__post_comment_obj}
Saving...
{:then} @@ -539,8 +542,8 @@ Copy and paste link:
${ type="text" id="external_person_id" name="external_person_id" - value={$idaa_slct.post_comment_obj.external_person_id - ? $idaa_slct.post_comment_obj.external_person_id + value={$idaa_slct.post_comment_obj?.external_person_id + ? $idaa_slct.post_comment_obj?.external_person_id : $idaa_loc.novi_uuid} readonly={true} class="input w-96 form-control" @@ -556,8 +559,8 @@ Copy and paste link: ${ type="text" id="external_person_id" name="external_person_id" - value={$idaa_slct.post_comment_obj.external_person_id - ? $idaa_slct.post_comment_obj.external_person_id + value={$idaa_slct.post_comment_obj?.external_person_id + ? $idaa_slct.post_comment_obj?.external_person_id : ''} readonly={false} class="input w-96 form-control" @@ -580,8 +583,8 @@ Copy and paste link: ${ type="text" id="full_name" name="full_name" - value={$idaa_slct.post_comment_obj.full_name - ? $idaa_slct.post_comment_obj.full_name + value={$idaa_slct.post_comment_obj?.full_name + ? $idaa_slct.post_comment_obj?.full_name : $idaa_loc.novi_full_name} readonly={!$ae_loc.trusted_access} class="input w-96 form-control" @@ -601,8 +604,8 @@ Copy and paste link: ${ ${ {/if}