nsarrazin HF Staff commited on
Commit
1f73dd7
·
1 Parent(s): 8b18180

fix: remove legacy run in ChatWindow.svelte

Browse files
src/lib/components/chat/ChatWindow.svelte CHANGED
@@ -1,5 +1,5 @@
1
  <script lang="ts">
2
- import { run, createBubbler } from "svelte/legacy";
3
 
4
  const bubble = createBubbler();
5
  import type { Message, MessageFile } from "$lib/types/Message";
@@ -37,6 +37,7 @@
37
  import { cubicInOut } from "svelte/easing";
38
  import type { ToolFront } from "$lib/types/Tool";
39
  import { loginModalOpen } from "$lib/stores/loginModal";
 
40
 
41
  interface Props {
42
  messages?: Message[];
@@ -72,8 +73,10 @@
72
  let editMsdgId: Message["id"] | null = $state(null);
73
  let pastedLongContent = $state(false);
74
 
75
- run(() => {
76
- page.params.id && (isSharedRecently = false);
 
 
77
  });
78
 
79
  const dispatch = createEventDispatcher<{
@@ -193,7 +196,7 @@
193
  }
194
 
195
  // If last message is from user, scroll to bottom
196
- run(() => {
197
  if (lastMessage && lastMessage.from === "user") {
198
  scrollToBottom();
199
  }
 
1
  <script lang="ts">
2
+ import { createBubbler } from "svelte/legacy";
3
 
4
  const bubble = createBubbler();
5
  import type { Message, MessageFile } from "$lib/types/Message";
 
37
  import { cubicInOut } from "svelte/easing";
38
  import type { ToolFront } from "$lib/types/Tool";
39
  import { loginModalOpen } from "$lib/stores/loginModal";
40
+ import { beforeNavigate } from "$app/navigation";
41
 
42
  interface Props {
43
  messages?: Message[];
 
73
  let editMsdgId: Message["id"] | null = $state(null);
74
  let pastedLongContent = $state(false);
75
 
76
+ beforeNavigate(() => {
77
+ if (page.params.id) {
78
+ isSharedRecently = false;
79
+ }
80
  });
81
 
82
  const dispatch = createEventDispatcher<{
 
196
  }
197
 
198
  // If last message is from user, scroll to bottom
199
+ $effect(() => {
200
  if (lastMessage && lastMessage.from === "user") {
201
  scrollToBottom();
202
  }