Minor update to make the selected Post Comment update when the liveQuery value changes.

This commit is contained in:
Scott Idem
2025-08-12 12:02:46 -04:00
parent a4b3d3887f
commit d3f71be94e

View File

@@ -88,7 +88,20 @@ let lq__post_comment_obj = $derived(liveQuery(async () => {
let results = await db_posts.comment
.get($idaa_slct.post_comment_id ?? ''); // null or undefined does not reset things like '' does
$idaa_slct.post_comment_obj = { ...results };
// Check if results are different than the current $idaa_slct.post_comment_obj
if ($idaa_slct.post_comment_obj && results) {
if (JSON.stringify($idaa_slct.post_comment_obj) !== JSON.stringify(results)) {
$idaa_slct.post_comment_obj = { ...results };
if (log_lvl) {
console.log(`$idaa_slct.post_comment_obj = `, $idaa_slct.post_comment_obj);
}
} else {
if (log_lvl) {
console.log(`Post comment object has not changed for post_comment_id: ${$idaa_slct.post_comment_id}`);
}
}
}
return results;
}));