Fix URL reactivity in UploadedFile component
Browse filesCapture the URL without trailing slash once at component creation to prevent unnecessary reactive updates during navigation.
src/lib/components/chat/UploadedFile.svelte
CHANGED
|
@@ -20,7 +20,8 @@
|
|
| 20 |
|
| 21 |
let showModal = $state(false);
|
| 22 |
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
function truncateMiddle(text: string, maxLength: number): string {
|
| 26 |
if (text.length <= maxLength) {
|
|
|
|
| 20 |
|
| 21 |
let showModal = $state(false);
|
| 22 |
|
| 23 |
+
// Capture URL once at component creation to prevent reactive updates during navigation
|
| 24 |
+
let urlNotTrailing = page.url.pathname.replace(/\/$/, "");
|
| 25 |
|
| 26 |
function truncateMiddle(text: string, maxLength: number): string {
|
| 27 |
if (text.length <= maxLength) {
|