Sort of bug fix and improvements for IDAA BB notifications and loading a post based on the URL param.
This commit is contained in:
@@ -25,6 +25,18 @@ import Comp__post_obj_id_view from './ae_idaa_comp__post_obj_id_view.svelte';
|
||||
import Comp__post_options from './ae_idaa_comp__post_options.svelte';
|
||||
|
||||
|
||||
import { page } from '$app/state';
|
||||
|
||||
let post_id = page.url.searchParams.get('post_id') ?? null;
|
||||
if (!post_id) {
|
||||
$idaa_slct.post_id = null;
|
||||
} else {
|
||||
console.log(`ae Posts - [post_id] +page.ts: post_id = `, post_id);
|
||||
$idaa_slct.post_id = post_id;
|
||||
$idaa_trig.post_id = post_id;
|
||||
}
|
||||
|
||||
|
||||
$: lq__post_obj_li = liveQuery(async () => {
|
||||
let results = await db_posts.post
|
||||
.where('account_id')
|
||||
@@ -103,6 +115,7 @@ $: if ($idaa_trig.post_li) {
|
||||
}
|
||||
|
||||
$: if ($idaa_trig.post_id) {
|
||||
// log_lvl = 1;
|
||||
$idaa_trig.post_id = false;
|
||||
|
||||
if (log_lvl) {
|
||||
@@ -119,6 +132,20 @@ $: if ($idaa_trig.post_id) {
|
||||
try_cache: true,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
|
||||
$idaa_slct.post_obj = $idaa_prom.load__post_obj;
|
||||
|
||||
if (!page.url.searchParams.get('post_id')) {
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('post_id', $idaa_slct.post_id);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'post_id': $idaa_slct.post_id};
|
||||
window.parent.postMessage(message, "*");
|
||||
}
|
||||
|
||||
$idaa_sess.bb.show__modal_view__post_id = $idaa_slct.post_id;
|
||||
$idaa_sess.bb.show__modal_edit__post_id = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user