fix: use untrack() in \$state initialisers to silence state_referenced_locally warnings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from "svelte";
|
||||
import { _ } from "svelte-i18n";
|
||||
import { Button } from "$lib/components/ui/button";
|
||||
import { Card, CardContent } from "$lib/components/ui/card";
|
||||
@@ -28,8 +29,8 @@
|
||||
const { data } = $props();
|
||||
|
||||
const timeAgo = new TimeAgo("en");
|
||||
let isLiked = $state(data.likeStatus.liked);
|
||||
let likesCount = $state(data.video.likes_count || 0);
|
||||
let isLiked = $state(untrack(() => data.likeStatus.liked));
|
||||
let likesCount = $state(untrack(() => data.video.likes_count || 0));
|
||||
$effect(() => {
|
||||
isLiked = data.likeStatus.liked;
|
||||
likesCount = data.video.likes_count || 0;
|
||||
|
||||
Reference in New Issue
Block a user