fix: sync reactive state with data prop using \$effect
Replaces bare \$state(data.x) initialisers (which only capture the initial value) with \$state + \$effect pairs so that state stays in sync whenever page data is invalidated or the URL changes. Affects all list pages (searchValue) and all edit/detail pages (form fields). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,10 @@
|
||||
const timeAgo = new TimeAgo("en");
|
||||
let isLiked = $state(data.likeStatus.liked);
|
||||
let likesCount = $state(data.video.likes_count || 0);
|
||||
$effect(() => {
|
||||
isLiked = data.likeStatus.liked;
|
||||
likesCount = data.video.likes_count || 0;
|
||||
});
|
||||
let isLikeLoading = $state(false);
|
||||
let newComment = $state("");
|
||||
let showComments = $state(true);
|
||||
|
||||
Reference in New Issue
Block a user