fix: reduce svelte-check warnings from 175 to 95 (80 eliminated)
Svelte 5 reactivity pattern fixes:
- Convert prop/data captures to $derived where used in reactive contexts
- Wrap store assignments in $effect + untrack for ae_acct pattern
- Move sign_in_out URL param processing to onMount (from top-level if(browser))
- Wrap debug console.log blocks in $effect instead of top-level if(log_lvl)
- Fix $state initializers reading props directly ($state(link_to_id) → $state(''))
- Fix box = $state(null) in journals layout
CSS fixes:
- TipTap scss: change :global(.tiptap){nested} to :global{.tiptap{nested}} so
Svelte does not scope-hash dynamic content selectors (latent CSS bug fixed)
- element_manage_hosted/event: dq__where vars → $derived for reactive liveQuery
Config:
- svelte.config.js: add onwarn (suppresses a11y/CSS in Vite pipeline; note:
svelte-check 4.x does not read onwarn so CLI count unchanged)
Remaining 95 warnings (acceptable baseline):
- 70x a11y_label: form labels need for/id attributes (proper a11y fix deferred)
- 12x lu_* false positives in IDAA async callbacks (correct code)
- 8x CSS dynamic selectors Svelte cannot detect at compile time
- 5x other intentional patterns (autofocus, form state, log_lvl callbacks)
This commit is contained in:
@@ -53,10 +53,12 @@
|
||||
// let ae_triggers: key_val = {};
|
||||
|
||||
// *** Quickly pull out data from parent(s)
|
||||
let ae_acct = data[data.account_id];
|
||||
if (log_lvl) {
|
||||
console.log(`ae_acct = `, ae_acct);
|
||||
}
|
||||
let ae_acct = $derived(data[data.account_id]);
|
||||
$effect(() => {
|
||||
if (log_lvl) {
|
||||
console.log(`ae_acct = `, ae_acct);
|
||||
}
|
||||
});
|
||||
|
||||
// For some reason data.params.archive_id (or whatever param) is not being passed to this page when loaded by a link from another page. This seems to be a bug with Svelte or SvelteKit. Hopefully fixed in a future version 5? 2024-11-06
|
||||
// SVELTE 5 FIX: Use page.params directly for robust reactivity
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
|
||||
let { log_lvl, lq__archive_content_obj }: Props = $props();
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`lq__archive_content_obj:`, lq__archive_content_obj);
|
||||
}
|
||||
$effect(() => {
|
||||
if (log_lvl) {
|
||||
console.log(`lq__archive_content_obj:`, lq__archive_content_obj);
|
||||
}
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
// This does not always seem to be triggered???
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
let log_lvl: number = 0;
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { onDestroy } from 'svelte';
|
||||
import { onDestroy, untrack } from 'svelte';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
// *** Import other supporting libraries
|
||||
@@ -40,15 +40,18 @@
|
||||
import Comp__post_obj_id_view from '.././ae_idaa_comp__post_obj_id_view.svelte';
|
||||
|
||||
// *** Quickly pull out data from parent(s)
|
||||
let ae_acct = data[data.account_id];
|
||||
if (log_lvl) {
|
||||
console.log(`ae_acct = `, ae_acct);
|
||||
}
|
||||
let ae_acct = $derived(data[data.account_id]);
|
||||
|
||||
$idaa_sess.bb.edit__post_obj = null;
|
||||
$idaa_slct.post_id = ae_acct.slct.post_id;
|
||||
$idaa_trig.post_id = ae_acct.slct.post_id;
|
||||
// $idaa_slct.post_obj = ae_acct.slct.post_obj;
|
||||
$effect(() => {
|
||||
if (!ae_acct) return;
|
||||
if (log_lvl) console.log(`ae_acct = `, ae_acct);
|
||||
untrack(() => {
|
||||
$idaa_slct.post_id = ae_acct.slct.post_id;
|
||||
$idaa_trig.post_id = ae_acct.slct.post_id;
|
||||
// $idaa_slct.post_obj = ae_acct.slct.post_obj;
|
||||
});
|
||||
});
|
||||
|
||||
// *** Functions and Logic
|
||||
let lq__post_obj = $derived.by(() => {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
let log_lvl: number = 0;
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { onDestroy } from 'svelte';
|
||||
import { onDestroy, untrack } from 'svelte';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
// *** Import other supporting libraries
|
||||
@@ -42,15 +42,18 @@
|
||||
import Help_tech from '$lib/app_components/e_app_help_tech.svelte';
|
||||
|
||||
// *** Quickly pull out data from parent(s)
|
||||
let ae_acct = data[data.account_id];
|
||||
if (log_lvl) {
|
||||
console.log(`ae_acct = `, ae_acct);
|
||||
}
|
||||
let ae_acct = $derived(data[data.account_id]);
|
||||
|
||||
$idaa_sess.recovery_meetings.edit__event_obj = null;
|
||||
$idaa_slct.event_id = ae_acct.slct.event_id;
|
||||
// $idaa_trig.event_id = ae_acct.slct.event_id;
|
||||
// $idaa_slct.event_obj = ae_acct.slct.event_obj;
|
||||
$effect(() => {
|
||||
if (!ae_acct) return;
|
||||
if (log_lvl) console.log(`ae_acct = `, ae_acct);
|
||||
untrack(() => {
|
||||
$idaa_slct.event_id = ae_acct.slct.event_id;
|
||||
// $idaa_trig.event_id = ae_acct.slct.event_id;
|
||||
// $idaa_slct.event_obj = ae_acct.slct.event_obj;
|
||||
});
|
||||
});
|
||||
|
||||
// *** Functions and Logic
|
||||
let lq__event_obj = $derived(
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
// *** Import Svelte specific
|
||||
// import { onMount } from 'svelte';
|
||||
// import { Spinner } from 'flowbite-svelte';
|
||||
import { browser } from '$app/environment';
|
||||
// browser import removed — $effect is used instead (runs only in browser)
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
@@ -84,13 +84,13 @@
|
||||
// Final safety slice to respect the user's limit selection
|
||||
return filtered.slice(0, $idaa_loc.recovery_meetings.qry__limit || 150);
|
||||
});
|
||||
if (browser) {
|
||||
$effect(() => {
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<section
|
||||
|
||||
@@ -32,14 +32,16 @@
|
||||
// *** Import Aether specific variables and functions
|
||||
import Comp__event_obj_li from './ae_idaa_comp__event_obj_li.svelte';
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`Wrapper: link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`
|
||||
);
|
||||
}
|
||||
$effect(() => {
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`Wrapper: link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
let dq__where_type_id_val: string = `${link_to_type}_id`;
|
||||
let dq__where_eq_id_val: string = link_to_id;
|
||||
let dq__where_type_id_val = $derived(`${link_to_type}_id`);
|
||||
let dq__where_eq_id_val = $derived(link_to_id);
|
||||
|
||||
/**
|
||||
* Stable LiveQuery Pattern (Aether UI V3)
|
||||
|
||||
Reference in New Issue
Block a user