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:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
// untrack import removed — task_id sync now uses direct $effect (no untrack needed)
|
||||
// Imports
|
||||
// Import components and elements
|
||||
import * as Lucide from 'lucide-svelte';
|
||||
@@ -63,7 +63,7 @@
|
||||
}: Props = $props();
|
||||
|
||||
// Local Variables
|
||||
let task_id = $state(link_to_id);
|
||||
let task_id: string = $state('');
|
||||
let input_file_list: any = $state(null);
|
||||
let ae_promises: key_val = $state({}); // Promise<any>;
|
||||
let ae_triggers: key_val = {};
|
||||
@@ -78,11 +78,8 @@
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
// NOTE: Standard Svelte 5 pattern to keep local state in sync with changing props.
|
||||
// This prevents 'Captured initial value' issues when navigating between objects.
|
||||
untrack(() => {
|
||||
task_id = link_to_id;
|
||||
});
|
||||
// Sync task_id with link_to_id prop so it resets when navigating to a different object.
|
||||
task_id = link_to_id;
|
||||
});
|
||||
|
||||
// *** Functions and Logic
|
||||
|
||||
Reference in New Issue
Block a user