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:
@@ -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,
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user