From c6992b0fcaf4088cfcba1b39bf04f7c65db3cb02 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 8 Nov 2024 15:27:23 +0100 Subject: [PATCH] web/main: use insertion effect for style injection --- web/src/ui/MainScreen.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/ui/MainScreen.tsx b/web/src/ui/MainScreen.tsx index 34c01f5..764971f 100644 --- a/web/src/ui/MainScreen.tsx +++ b/web/src/ui/MainScreen.tsx @@ -13,7 +13,7 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -import { use, useEffect, useMemo, useReducer, useState } from "react" +import { use, useEffect, useInsertionEffect, useMemo, useReducer, useState } from "react" import Client from "@/api/client.ts" import { RoomStateStore } from "@/api/statestore" import type { RoomID } from "@/api/types" @@ -93,7 +93,7 @@ const MainScreen = () => { [client], ) useEffect(() => context.keybindings.listen(), [context]) - useEffect(() => { + useInsertionEffect(() => { const styleTags = document.createElement("style") styleTags.textContent = ` div.html-body > a.hicli-matrix-uri-user[href="matrix:u/${client.userID.slice(1).replaceAll(`"`, `\\"`)}"] {