Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix vica hydration bug #1018

Merged
merged 2 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const VicaStylesheet = () => {
return (
<>
<link
href="https://webchat.vica.gov.sg/static/css/chat.css"
referrerPolicy="origin"
rel="stylesheet"
/>
</>
)
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import type { VicaProps } from "~/interfaces"
"use client"

export const VicaStylesheet = () => {
return (
<>
<link
href="https://webchat.vica.gov.sg/static/css/chat.css"
referrerPolicy="origin"
rel="stylesheet"
/>
</>
)
}
import type { VicaProps } from "~/interfaces"

export const VicaWidget = ({
ScriptComponent = "script",
...props
}: VicaProps) => {
// to not render during static site generation on the server
if (typeof window === "undefined") return null

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: prefer !window

return (
<>
<ScriptComponent
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./Vica"
export * from "./VicaWidget"
export * from "./VicaStylesheet"
Loading