Chats: Absturz in neueren Browsern behoben

Der Effekt zum Mitscrollen gab das Ergebnis von scrollIntoView zurück.
Neuere Chromium-Versionen liefern dort ein Promise statt undefined, und
React ruft den Rückgabewert eines Effekts beim nächsten Durchlauf als
Aufräumfunktion auf: „l is not a function“, die App zeigte die
Fehlerseite. In Firefox mit einem Promise-liefernden scrollIntoView
nachgestellt und danach geprüft.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiXsPUqw7oeomZ8wZrQW5q
This commit is contained in:
irrlicht
2026-10-13 18:31:35 +02:00
co-authored by Claude Opus 5.5
parent 9384d22569
commit 0d52d28d1b
2 changed files with 6 additions and 1 deletions
+5 -1
View File
@@ -195,7 +195,11 @@ function Messages(props: { me: string; other: string; ring: Keyring; ownKey: Key
});
const myAvatar = useMe().data?.avatar ?? "";
const end = useRef<HTMLDivElement>(null);
useEffect(() => end.current?.scrollIntoView({ block: "nearest" }), [shown.length]);
// In Klammern: Neuere Browser geben bei scrollIntoView ein Promise zurück,
// und was ein Effekt zurückgibt, ruft React später als Aufräumfunktion auf.
useEffect(() => {
end.current?.scrollIntoView({ block: "nearest" });
}, [shown.length]);
return (
<>