Skip to content

Commit a8e8bae

Browse files
ILoveScratch2jyxjjjCopilot
authored
fix(share): prevent same announcement display (#215)
* fix(share): prevent same announcement display * Remove unused createSignal (by Copilot) Co-authored-by: Copilot <[email protected]> Signed-off-by: ShenLin <[email protected]> --------- Signed-off-by: ShenLin <[email protected]> Co-authored-by: ShenLin <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 45e41d1 commit a8e8bae

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/pages/home/Layout.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,20 @@ import { Body } from "./Body"
66
import { Footer } from "./Footer"
77
import { Header } from "./header/Header"
88
import { Toolbar } from "./toolbar/Toolbar"
9+
import { onMount } from "solid-js"
10+
11+
let announcementShown = false
912

1013
const Index = () => {
1114
useTitle(getSetting("site_title"))
1215
const announcement = getSetting("announcement")
13-
if (announcement) {
14-
notify.render(<Markdown children={announcement} />)
15-
}
16+
17+
onMount(() => {
18+
if (announcement && !announcementShown) {
19+
notify.render(() => <Markdown children={announcement} />)
20+
announcementShown = true
21+
}
22+
})
1623
return (
1724
<>
1825
<Header />

0 commit comments

Comments
 (0)