Skip to content

Commit 18ff407

Browse files
committed
fix: resolve svelte-check types and reactivity warnings
1 parent 88704fe commit 18ff407

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

apps/web/src/routes/devcard/[id]/+page.server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ export const load: PageServerLoad = async ({ params, fetch }) => {
1919

2020
const card = await res.json();
2121
return { card };
22-
} catch (error) {
23-
if (error && typeof error === 'object' && 'status' in error) {
24-
throw error;
22+
} catch (err) {
23+
if (err && typeof err === 'object' && 'status' in err) {
24+
throw err;
2525
}
2626
throw error(500, 'Failed to connect to backend');
2727
}

apps/web/src/routes/u/[username]/+page.svelte

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import { onMount } from 'svelte';
44
55
let { data } = $props();
6-
const profile = data.profile;
7-
const error = data.error;
6+
const profile = $derived(data.profile);
7+
const error = $derived(data.error);
88
99
const platformColors: Record<string, string> = {
1010
github: '#181717', linkedin: '#0A66C2', twitter: '#000000',
@@ -18,6 +18,7 @@
1818
let copyMessage = $state('');
1919
let copyStatus = $state<'success' | 'error'>('success');
2020
let copyMessageTimeout: ReturnType<typeof setTimeout>;
21+
let copyTimeout: ReturnType<typeof setTimeout>;
2122
2223
onMount(() => {
2324
mounted = true;
@@ -37,7 +38,9 @@
3738
clearTimeout(copyMessageTimeout);
3839
}
3940
40-
clearTimeout(copyTimeout);
41+
if (copyTimeout) {
42+
clearTimeout(copyTimeout);
43+
}
4144
4245
copyTimeout = setTimeout(() => {
4346
copyMessage = '';

0 commit comments

Comments
 (0)