Minor update to make the selected Post Comment update when the liveQuery value changes.
This commit is contained in:
@@ -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;
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user