fix: resolve Svelte 5 reactivity warnings (#974)

- Use untrack() for $derived/$state initial values captured outside reactive context (scene.svelte, lists edit page)
- Add $state() to bind:this component references in settings account page

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Flomp <Flomp@users.noreply.github.com>
This commit is contained in:
slothful-vassal
2026-05-10 08:42:20 +02:00
committed by GitHub
parent edad99c7b4
commit 1b2781960a
3 changed files with 9 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
<script lang="ts">
import { theme } from "$lib/stores/theme_store";
import { untrack } from "svelte";
import { T, useTask } from "@threlte/core";
import { backInOut } from "svelte/easing";
import { Tween } from "svelte/motion";
@@ -56,7 +57,7 @@
rotation += delta / 2;
});
const sunZPosition = new Tween($theme == "light" ? sunUpPosition : 0, {
const sunZPosition = new Tween(untrack(() => ($theme == "light" ? sunUpPosition : 0)), {
duration: 1000,
easing: backInOut,
});
@@ -71,7 +72,7 @@
sunLightIntensity.set($theme == "light" ? 4 : 0);
});
const moonZPosition = new Tween($theme == "dark" ? sunUpPosition : 0, {
const moonZPosition = new Tween(untrack(() => ($theme == "dark" ? sunUpPosition : 0)), {
duration: 1000,
easing: backInOut,
});

View File

@@ -51,7 +51,7 @@
let loading: boolean = $state(false);
let newShares: TrailShare[] = [];
let publicList: boolean = $state(data.list?.public);
let publicList: boolean = $state(untrack(() => data.list?.public));
let shareConfirmModal: ConfirmModal;
let publishConfirmModal: ConfirmModal;

View File

@@ -32,11 +32,11 @@
let citySearchQuery: string = "";
let confirmModal: ConfirmModal;
let emailModal: EmailModal;
let passwordModal: PasswordModal;
let tokenModal: ApiTokenModal;
let tokenSuccessModal: ApiTokenSuccessModal;
let confirmModal: ConfirmModal = $state()!;
let emailModal: EmailModal = $state()!;
let passwordModal: PasswordModal = $state()!;
let tokenModal: ApiTokenModal = $state()!;
let tokenSuccessModal: ApiTokenSuccessModal = $state()!;
let tokenLoading: boolean = $state(false);
let rawAPIToken: string | null = $state(null);